1 xcode login loginview uisplitviewcontroller
我在我的iPad应用程序上使用splitViewController,但在此之前,我有一个登录,并在成功验证后刷新根和详细信息视图.问题是,一旦我加载主视图没有任何反应,我尝试推送任何视图,没有事件.
当我以模态方式加载Login视图时,我收到此错误:"不平衡调用开始/结束外观转换为
我使用以下命令在主视图(frontViewController)中执行登录视图:
-(void)displayLoginView:(BOOL)animated{
LoginView *loginController = [[LoginView alloc] initWithNibName:@"LoginView" bundle:nil];
[self presentModalViewController:loginController animated:YES];
Run Code Online (Sandbox Code Playgroud)
}
- (void)viewDidLoad{
[super viewDidLoad];
//Add logout button
Run Code Online (Sandbox Code Playgroud)
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Logout"style:UIBarButtonItemStyleBordered target:self action:@selector(logout)]; //如果尚未登录,则显示登录视图[self displayLoginView:NO]; }
-(void)logout{
[self displayLoginView:YES];
Run Code Online (Sandbox Code Playgroud)
}
和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;
Run Code Online (Sandbox Code Playgroud)
}
有人可以帮帮我吗?
非常感谢提前!
Abz*_*mon 13
检查你的viewWillAppear:animated:, viewDidAppear:animated:, viewWillDisappear:animated:, and viewDidDisappear:animated:方法,你要么不实现它们,要么你必须调用[super viewDid ....].我有相同的pb,原因是shouldAutoRotateToInterfaceOrientation:其中一个返回false而其他人返回true,我设置它们返回相同的一个没关系.
| 归档时间: |
|
| 查看次数: |
8384 次 |
| 最近记录: |