解决 " 登录页面(没有导航栏)跳转到下一页面(有导航栏) " 问题

如果登录页面为根视图,下面可以这么写。


在appDelegate.m中

loginViewController *loginVC = [[loginViewController alloc]init];
UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:loginVC];
self.window.rootViewController = navigationController;

在loginViewController.m中

//隐藏导航栏
-(void)viewWillAppear:(BOOL)animated{
  self.navigationController.navigationBarHidden = YES;
}


//跳转方法
-(void)goToView:(UIButton*)button{
  temporaryViewController *temporaryVC = [[temporaryViewController alloc]init];
  [self.navigationController pushViewController:temporaryVC animated:NO];
}





你可能感兴趣的:(导航栏)