내 응용 프로그램에 NavigationController가있는 기본 MainWindow.xib가 있습니다.응용 프로그램이 시뮬레이터에서 작동하고 장치의 흰색 화면이
내 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 지금은 최근 HelloiPhone의 하단에 제공되는 예와 유사한 XIB없는 메인 윈도우와 RootViewController (의 UIViewController의 서브 클래스)로 전환 :
<?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가 표시되지 않습니다. 대신 시작 이미지 이후 화면이 흰색으로 바뀝니다. (상단의 상태 표시 줄이 그대로 있습니다.)
이 방법에 문제가 있습니까? 내가 놓친 게 있니?
어쩌면 차이는 없겠지만 "navigationController.LoadView();" 선. LoadView()는 컨트롤러의 View 속성에 액세스 할 때 호출되며 직접 호출하면 안됩니다. –