我有以下代码从导航控制器启动密码视图控制器。除了首次启动应用程序外,此代码每次都有效。因此,应用程序在启动时不会显示锁定屏幕。在针对每个睡眠模式启动之后,呈现密码VC。我发现当应用程序启动loadView时,第一次没有调用viewwillappear。对此有任何帮助表示赞赏。这是代码:
_passcodeViewController = [[KKPasscodeViewController alloc] initWithNibName:nil bundle:nil];
_passcodeViewController.mode = KKPasscodeModeEnter;
_passcodeViewController.hideCancel = YES;
_passcodeViewController.delegate = self;
_passcodeViewController.edgesForExtendedLayout = UIRectEdgeNone;
_passcodeViewController.isLaunchingVideoCall = isLaunchingVideoCall;
_passcodeCompletion = nil;
_passcodeNavController = [[UINavigationController alloc] initWithRootViewController:_passcodeViewController];
UINavigationController* rootNav = (UINavigationController*)self.window.rootViewController;
[rootNav presentViewController:_passcodeNavController animated:YES completion:nil];
答案 0 :(得分:0)
我想你错过了NibName, 你的代码看起来像这样
_passcodeViewController = [[KKPasscodeViewController alloc] initWithNibName:@"KKPasscodeViewController" bundle:nil];