Rom*_*anS 1 nsnotifications uiviewcontroller ios
我添加了通知我的UIViewController进行捕获
- (void)applicationWillResignActive:(UIApplication *)application:
Run Code Online (Sandbox Code Playgroud)
像这样
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:)
name:APP_RESIGN_ACTIVE_NOTIFICATION object:nil];
Run Code Online (Sandbox Code Playgroud)
它工作正常,但如果我显示其他控制器:
[self presentViewController:[[UINavigationController alloc] initWithRootViewController:view]
animated:YES
completion:nil];
Run Code Online (Sandbox Code Playgroud)
通知停止工作.我只删除了通知
- (void)viewDidUnload {
[super viewDidUnload];
[[NSNotificationCenter defaultCenter] removeObserver:self name:APP_RESIGN_ACTIVE_NOTIFICATION object:nil];
Run Code Online (Sandbox Code Playgroud)
但是当我显示模态控制器时它没有被调用.
| 归档时间: |
|
| 查看次数: |
338 次 |
| 最近记录: |