我在 Xcode 4.3 中有一个标签栏应用程序,我试图在显示标签栏之前插入一个登录屏幕。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>
。