Sim*_*mon 2 iphone nsnotificationcenter
在我viewDidLoad,我添加我的控制器作为两个通知的观察者:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkNetworkStatus:) name:NetworkStatusChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkLocationStatus:) name:LocationStatusChangedNotification object:nil];
Run Code Online (Sandbox Code Playgroud)
在我dealloc,我应该删除一次,还是两次?removeObserver方法似乎没有指定特定通知.
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:self]; // is this required?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
996 次 |
| 最近记录: |