应用程序在模拟器中运行,设备上出现白屏
我的应用程序有默认的 MainWindow.xib,其中有一个 NavigationController。现在,我最近将其切换到无 xib 主窗口和 RootViewController (UIViewController 的子类),类似于 HelloiPhone:
我的 Main.cs:
namespace MyApp {
public class Application {
static void Main(string[] args) {
UIApplication.Main(args, null, "MyApp.AppDelegate");
}
}
public class AppDelegate : UIApplicationDelegate {
UIWindow window;
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching(UIApplication app, NSDictionary options) {
RootViewController rootViewController = new RootViewController();
UINavigationController navigationController = new UINavigationController(rootViewController);
navigationController.LoadView();
navigationController.NavigationBar.BarStyle = UIBarStyle.Black;
window = new UIWindow(UIScreen.MainScreen.Bounds);
window.AddSubview(navigationController.View);
window.MakeKeyAndVisible();
return true;
}
// This method is required in iPhoneOS 3.0
public override void OnActivated(UIApplication app) {
}
public override void WillTerminate(UIApplication app) {
//Save data here
}
}
}
我的 Info.plist:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UILaunchImageFile</key>
<string>images/logo_320x480.png</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
</dict>
</plist>
在模拟器上,一切看起来都很好。首先,显示启动图像,最后几秒钟后出现 rootView。
但是,当部署到设备(iPod touch)时,rootView 将不会显示。相反,启动图像后屏幕会变成白色。 (顶部状态栏仍然存在)
这种方法有什么问题吗?我错过了什么吗?
My app had the default MainWindow.xib with a NavigationController in it. Now I recently switched it to a xib-less main window and RootViewController (subclass of UIViewController) similar to the example provided at the bottom of HelloiPhone:
My Main.cs:
namespace MyApp {
public class Application {
static void Main(string[] args) {
UIApplication.Main(args, null, "MyApp.AppDelegate");
}
}
public class AppDelegate : UIApplicationDelegate {
UIWindow window;
// This method is invoked when the application has loaded its UI and its ready to run
public override bool FinishedLaunching(UIApplication app, NSDictionary options) {
RootViewController rootViewController = new RootViewController();
UINavigationController navigationController = new UINavigationController(rootViewController);
navigationController.LoadView();
navigationController.NavigationBar.BarStyle = UIBarStyle.Black;
window = new UIWindow(UIScreen.MainScreen.Bounds);
window.AddSubview(navigationController.View);
window.MakeKeyAndVisible();
return true;
}
// This method is required in iPhoneOS 3.0
public override void OnActivated(UIApplication app) {
}
public override void WillTerminate(UIApplication app) {
//Save data here
}
}
}
My Info.plist:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UILaunchImageFile</key>
<string>images/logo_320x480.png</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
</dict>
</plist>
On the simulator, everything seems well. At first, the launching image is displayed and finally the rootView appears after a few seconds.
However, when deploying to the device (iPod touch), the rootView won't display. Instead, the screen turns to white after the launching image. (Status bar at the top is still there)
Is there something wrong with that approach? Am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能会在这里找到一些有用的信息:
differences- Between-iphone-ipod-simulator-和设备
iphone-device-vs-iphone-simulator
You might find some useful info here:
differences-between-iphone-ipod-simulator-and-devices
iphone-device-vs-iphone-simulator
白屏与切换到无 xib 无关。
白色屏幕实际上是我的 rootView,具有白色背景,一些图像和一些具有背景图像和白色字体颜色的按钮。我不久前将文件夹“images”重命名为“Images”,并受到设备上区分大小写的影响。没有显示图像,其他一切都是白色的,所以我没有看到它。
如果我在切换到无 xib 之前在设备上进行了测试,我可以直接将其与重命名文件夹相关联。
The white screen was not related to switching to xib-less.
The white screen was actually my rootView with white background, some images and some buttons with background images and white font color. I renamed the folder "images" to "Images" a while back and got hit by case-sensitivy on the device. No images displayed and everything else was white so I didn't see it.
If I had tested on the device before switching to xib-less, I could've directly related it to renaming the folder.