我有 2 个问题,关于Sencha touch
和phone gap
;
我正在阅读 Ajith kumar 的 SenchaTouch CookBook。我正在按照第 1 章中给出的示例程序进行操作。所以据此我做了以下。
这是我的index.html
<!DOCTYPE HTML>
<html>
<head>
<title>Yapps! - Your daily applications!</title>
<link rel="stylesheet" href="sencha-
touch/resources/css/sencha-touch.css" type="text/css">
<link rel="stylesheet" href="sencha-
touch/resources/css/yapps-all.css" type="text/css">
<script type="text/javascript" charset="utf-8"
src="phonegap.1.0.0.js"></script>
<script type="text/javascript" charset="utf-8" src="sencha-
touch/sencha-touch.js"></script>
<script type="text/javascript" charset="utf-8"
src="ch01/ch01_03.js"></script>
<script type="text/javascript" charset="utf-8" src="sencha-
touch/yapps-all.js"></script>
</head>
<body></body>
</html>
该ch01_03.js
文件。被告知将这些 .JS 文件添加到 WWW 文件夹中,但我无法在该文件夹中添加任何文件,因此我将其添加到文件夹之外。
Ext.setup({
onReady: function() {
var supportedFeatures = "Ext.supports.AudioTag : " +
(Ext.supports.AudioTag ? "On" : "Off");
supportedFeatures += "\nExt.supports.CSS3BorderRadius : " +
(Ext.supports.CSS3BorderRadius ? "On" : "Off");
supportedFeatures += "\nExt.supports.CSS3DTransform : " +
(Ext.supports.CSS3DTransform ? "On" : "Off");
supportedFeatures += "\nExt.supports.CSS3LinearGradient : " +
(Ext.supports.CSS3LinearGradient ? "On" : "Off");
supportedFeatures += "\nExt.supports.Canvas : " +
(Ext.supports.Canvas ? "On" : "Off");
supportedFeatures += "\nExt.supports.DeviceMotion : " +
(Ext.supports.DeviceMotion ? "On" : "Off");
supportedFeatures += "\nExt.supports.Float : " +
(Ext.supports.Float ? "On" : "Off");
supportedFeatures += "\nExt.supports.GeoLocation : " +
(Ext.supports.GeoLocation ? "On" : "Off");
supportedFeatures += "\nExt.supports.History : " +
(Ext.supports.History ? "On" : "Off");
supportedFeatures += "\nExt.supports.OrientationChange : " +
(Ext.supports.OrientationChange ? "On" : "Off");
supportedFeatures += "\nExt.supports.RightMargin : " +
(Ext.supports.RightMargin ? "On" : "Off");
supportedFeatures += "\nExt.supports.SVG : " +
(Ext.supports.SVG ? "On" : "Off");
supportedFeatures += "\nExt.supports.Touch : " +
(Ext.supports.Touch ? "On" : "Off");
supportedFeatures += "\nExt.supports.Transitions : " +
(Ext.supports.Transitions ? "On" : "Off");
supportedFeatures += "\nExt.supports.TransparentColor : " +
(Ext.supports.TransparentColor ? "On" : "Off");
supportedFeatures += "\nExt.supports.VML : " +
(Ext.supports.VML ? "On" : "Off");
Ext.Msg.alert("INFO", supportedFeatures);
}
});
1.) 问题是当我在 iPhone 和 Stimulator 上运行它时,我只看到一个空白屏幕。这是怎么回事,我应该怎么做才能让警报显示在视图上?
2.) 我需要检测我正在运行应用程序的设备。在书中,它展示了如何检测 iPad、Android 应用程序和 Blackberry。但不是 iPhone。如何检测 iPhone?
Ext.setup({
onReady: function() {
if (Ext.is.Android)
Ext.Msg.alert("INFO", "Welcome Android user!");
if (Ext.is.Blackberry)
Ext.Msg.alert("INFO", "Welcome Blackberry user!");
if (Ext.is.iPad)
Ext.Msg.alert("INFO", "Welcome iPad user!");
} });