我在我的 iPad 应用程序上使用了 splitViewController,但在此之前,我有一个登录名,并且在成功通过身份验证后,我刷新了根视图和详细视图。问题是,一旦我加载主视图没有任何反应,我尝试推送任何视图并且没有事件。
当我以模态方式加载登录视图时,我收到此错误:“开始/结束外观转换的不平衡调用
我使用以下方法在主视图(frontViewController)中进行登录视图:
-(void)displayLoginView:(BOOL)animated{
LoginView *loginController = [[LoginView alloc] initWithNibName:@"LoginView" bundle:nil];
[self presentModalViewController:loginController animated:YES];
}
- (void)viewDidLoad{
[super viewDidLoad];
//Add logout button
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Logout" style:UIBarButtonItemStyleBordered target:self action:@selector(logout)]; //如果还没有登录,显示登录视图 [self displayLoginView:NO]; }
-(void)logout{
[self displayLoginView:YES];
}
和 appdelegate.m :
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
FrontViewController *frontViewController;
RearViewController *rearViewController;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
frontViewController = [[FrontViewController alloc] initWithNibName:@"FrontViewController_iPhone" bundle:nil];
rearViewController = [[RearViewController alloc] initWithNibName:@"RearViewController_iPhone" bundle:nil];
}
else{
frontViewController = [[FrontViewController alloc] initWithNibName:@"FrontViewController_iPad" bundle:nil];
rearViewController = [[RearViewController alloc] initWithNibName:@"RearViewController_iPad" bundle:nil];
}
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
RevealController *revealController = [[RevealController alloc] initWithFrontViewController:navigationController rearViewController:rearViewController];
self.viewController = revealController;
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
有人可以帮助我吗?
非常感谢提前!