我想在進入前臺應用程序時提供一個UIViewController。
我在Objective C appDelegate應用程序中使用此代碼applicationWillEnterForeground方法,但它不適用於我。如何在應用程序委託iOS10的applicationWillEnterForeground方法中呈現模態UIViewController目標C
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PasscodeViewController *vc = [sb instantiateViewControllerWithIdentifier:@"passcodeVCID"];
[self presentViewController:vc animated:YES completion:nil];
那你估計是'裏面的appDelegate self'? – NSNoob
我以前在uiviewcontroller中使用SELF。有作品。但我不知道如何在這裏處理它。 –
這是因爲在UIViewController類中,self是一個ViewController。 'presentViewController'是一個在UIViewController.h中定義的方法,所以它在那裏工作。在AppDelegate中,self是AppDelegate,它沒有名爲'presentViewController'的方法。 – NSNoob