// remove notification observer
[[NSNotificationCenter defaultCenter] removeObserver:self];
// add notification observer
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(default:) name:kDefault object:nil];
// post notification
[[NSNotificationCenter defaultCenter] postNotificationName:kDefault object:nil];
// post notification with object
NSDictionary* dict = [NSDictionary dictionaryWithObject:_chatField.text forKey:@"chatText"];
[[NSNotificationCenter defaultCenter] postNotification:
[NSNotification notificationWithName:@"chatText"
object:self
userInfo:dict]];
// example
- (void)updateLocationOnMapView:(NSNotification *)notification
{
NSString *chatText = [notification.userInfo objectForKey:@"chatText"];
NSLog(@"received chat text : %@", chatText);
}
댓글 없음:
댓글 쓰기