您好我正在尝试在 viewDidLoad 中推送视图控制器
我正在使用故事板。在 ViewDidLoad 中,我正在检查用户是否登录并创建了他的个人资料。如果用户未登录或未创建个人资料,则推送另一个视图控制器以进行登录/个人资料视图。以下代码不起作用。
- (void)viewDidLoad
if(USER_IS_LOGGED_IN)
{
if(USER_PROFILE_COMPLETED)
{
[self sendRequest];
}
else
{
//push profile view
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ProfileViewController *profileViewController = (ProfileViewController *)[storyboard instantiateViewControllerWithIdentifier:@"ProfileView"];
profileViewController.isFromDealView = YES;
profileViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:profileViewController animated:YES];
}
}
else
{
//push login view
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
LoginViewController *loginViewController = (LoginViewController *)[storyboard instantiateViewControllerWithIdentifier:@"LoginView"];
loginViewController.isFromDealView = YES;
loginViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:loginViewController animated:YES];
}
}