我有一個UITabBarController,當初始運行時,我想覆蓋登錄視圖控制器但收到錯誤。UITabBarController的開始/結束外觀轉換的不平衡調用
對於< UITabBarController:0x863ae00>開始/結束外觀轉換的不平衡調用。
以下是代碼。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
UIViewController *lessonVC = [[[LessonViewController alloc] initWithNibName:@"LessonViewController" bundle:nil] autorelease];
UIViewController *programVC = [[[ProgramViewController alloc] initWithNibName:@"ProgramViewController" bundle:nil] autorelease];
UIViewController *flashcardVC = [[[FlashCardViewController alloc] initWithNibName:@"FlashCardViewController" bundle:nil] autorelease];
UIViewController *moreVC = [[[MoreViewController alloc] initWithNibName:@"MoreViewController" bundle:nil] autorelease];
UINavigationController *lessonNVC = [[[UINavigationController alloc] initWithRootViewController:lessonVC] autorelease];
UINavigationController *programNVC = [[[UINavigationController alloc] initWithRootViewController:programVC] autorelease];
UINavigationController *flashcardNVC = [[[UINavigationController alloc] initWithRootViewController:flashcardVC] autorelease];
UINavigationController *moreNVC = [[[UINavigationController alloc] initWithRootViewController:moreVC] autorelease];
self.tabBarController = [[[UITabBarController alloc] init/*WithNibName:nil bundle:nil*/] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:lessonNVC, programNVC, flashcardNVC, moreNVC, nil];
self.tabBarController.selectedIndex = 0;
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
if (![[ZYHttpRequest sharedRequest] userID])
{
// should register or login firstly
LoginViewController *loginVC = [[LoginViewController alloc] initWithNibName:@"LoginViewController"
bundle:nil];
loginVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.tabBarController presentModalViewController:loginVC animated:YES];
ZY_SAFE_RELEASE(loginVC);
}
return YES;
}
任何人都可以幫助我嗎?提前致謝!
另外,我檢查了這個[http://stackoverflow.com/q/7886096/527539]。但沒有運氣。 – ZYiOS 2011-12-19 15:25:30