我在Xcode 4.3中有一個選項卡欄應用程序,我試圖在顯示tabbar之前插入登錄屏幕。如果presentModalViewController
具有animated:YES
,則應用程序可以正常工作,但如果它沒有動畫,則視圖不顯示。選項卡式應用程序不會顯示登錄視圖
@synthesize window = _window;
@synthesize tabBarController = _tabBarController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
self.window.rootViewController = self.tabBarController;
LogInViewController *logViewController = [[LogInViewController alloc] initWithNibName:@"LogInViewController" bundle:nil];
[self.window addSubview:_tabBarController.view];
[self.tabBarController presentModalViewController:logViewController animated:YES];
//This wont work
//[self.tabBarController presentModalViewController:logViewController animated:NO];
[self.window makeKeyAndVisible];
return YES;
}
-(void)loginDone{
NSLog(@"back to the app delegate");
[self.tabBarController dismissModalViewControllerAnimated:YES];
}
- 這是做正確的方式?
- 爲什麼不能使用代碼
animated:NO
? - 我也得到這個在輸出
Unbalanced calls to begin/end appearance transitions for <UITabBarController: 0x689d350>
。