iOS 通知

註冊通知post

NSNotificationCenter * center = [NSNotificationCenter defaultCenter];
//添加當前類對象爲一個觀察者,name和object設置爲nil,表示接收一切通知
[center addObserver:self selector:@selector(notice:) name:@"123" object:nil];code

//建立一個消息對象
NSNotification * notice = [NSNotification notificationWithName:@ "123"  object:nil userInfo:@{@ "1" :@ "123" }];
//發送消息
[[NSNotificationCenter defaultCenter]postNotification:notice];
相關文章
相關標籤/搜索