从UInavigationcontroller呈现视图控制器后,不会调用ios 10加载视图和viewwillappear

时间:2017-07-30 19:00:42

标签: ios objective-c uiviewcontroller

我有以下代码从导航控制器启动密码视图控制器。除了首次启动应用程序外,此代码每次都有效。因此,应用程序在启动时不会显示锁定屏幕。在针对每个睡眠模式启动之后,呈现密码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];

1 个答案:

答案 0 :(得分:0)

我想你错过了NibName, 你的代码看起来像这样

_passcodeViewController = [[KKPasscodeViewController alloc] initWithNibName:@"KKPasscodeViewController" bundle:nil];