Saturday, April 27, 2013

NSNotificationCenter postNotificationName example ios


postNotificationName :object:

Creates a notification with a given name and sender and posts it to the receiver.
- (void)postNotificationName:(NSString *)notificationName object:(id)notificationSender
Parameters
notificationName
The name of the notification.
notificationSender
The object posting the notification.
Discussion of [NSNotificationCenter postNotificationName]
This method invokes postNotificationName :object:userInfo: with a userInfo argument of nil.
Example of [NSNotificationCenter postNotificationName]

[[NSNotificationCenter defaultCenter] postNotificationName:@"HotSpotTouched" object:self userInfo:itemDetails ];


- (void)hotSpotMore:(NSNotification *)notification {
      NSLog(@"%@", notification.userInfo);
      NSLog(@"%@", [notification.userInfo objectForKey:@"HelpTopic"]);    
}