![](/img/trans.png)
[英]ios : change window.rootViewController and memory management
[英]ios 6 iPhone window.rootViewController crashes
我的應用程序可以在iPad和iPhone上與iOS 5.1正常運行。 在iOS 6中,app可以在iPad上正常運行,但在設置window.rootViewController = navigationViewController
在iPhone中崩潰。 我已經設置了異常斷點,該斷點在application didFinishLaunchingWithOptions
這段代碼處停止執行。 我什至嘗試將其添加為[window addSubView:navigationViewController.view]
但沒有運氣。 有沒有人遇到過類似的問題。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
rootViewController = [[SpringboardViewController alloc] initWithNibName:@"SpringboardViewController" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.window.rootViewController = nav;
self.window makeKeyAndVisible];
return YES;
}
感謝您的答復家伙我想通了這個問題,問題出在application supportedInterfaceOrientationsForWindow
我在那里返回UIInterfaceOrientationPortrait
代替UIInterfaceOrientationMaskPortrait
因為應用程序調試器在self.window.rootViewController = NAV來襲,我認為問題是這種說法。
感謝Ravindharan和Ogres。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.