我有密码的xib,点击登录按钮后会有调用的Web服务,成功响应后,我必须出现密码的xib。
当我完成该部分时,我必须从提交的xib推送到另一个视图控制器。
这是我的代码:
[self dismissViewControllerAnimated:NO completion:^{
if ([_delegate respondsToSelector:@selector(unlockWasSuccessfulLockScreenViewController:pincode:)]) {
[_delegate unlockWasSuccessfulLockScreenViewController:self pincode:pincode];
PassCodeVC *sgn = [self.storyboard instantiateViewControllerWithIdentifier:@"PassCodeVC"];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:sgn];
[nav pushViewController:sgn animated:YES];
}
}];
我已经像这样提交了xib:
JKLLockScreenViewController * viewController = [[JKLLockScreenViewController alloc] initWithNibName:NSStringFromClass([JKLLockScreenViewController class]) bundle:nil];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:viewController];
[viewController setLockScreenMode:LockScreenModeNew]; // enum { LockScreenModeNormal, LockScreenModeNew, LockScreenModeChange }
[viewController setDelegate:self];
[viewController setDataSource:self];
[viewController setTintColor:[UIColor colorWithRed:53.0 / 255.0 green:115.0 / 255.0 blue:157.0 /255.0 alpha:1]];
[self presentViewController:nav animated:YES completion:nil];
答案 0 :(得分:0)
如果您希望使用当前导航,那么只需使用当前导航控制器简单地传递新控制器。
PassCodeVC *sgn = [self.storyboard instantiateViewControllerWithIdentifier:@"PassCodeVC"];
[self.navigationController pushViewController:childViewController animated:YES];
答案 1 :(得分:0)
您可能需要设置要加载的View Controller的Storyboard ID。它位于检查器中,位于您为视图控制器指定自定义类的位置下方。see this image