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?