通知的用法:
1,注册通知
NSNotificationCenter *center = [NSNotificationCenterdefaultCenter];
[center addObserver:selfselector:@selector(applicationDidBecomeActive:)
name:UIApplicationDidBecomeActiveNotificationobject:nil];
2,通知收到的处理方法
- (void)applicationDidBecomeActive: (NSNotification *)notification
{
notification是可以获取发送UIApplicationDidBecomeActiveNotification通知的对象传送过来的数据(包括object和userInfo)
}
3,发送通知的方法:
postNotificationName:UIApplicationDidBecomeActiveNotification object: userInfo:(自定义的字典对象,用于传送数据)