Call a function using Notification in Xcode

Step 1: Post Notification from class A.

NSString *data=@”Demo”;[[NSNotificationCenter defaultCenter] postNotificationName:@”golferUpdate” object:nil userInfo:data];if you do not want to pass data use 

[[NSNotificationCenter defaultCenter] postNotificationName:@golferUpdate object:nil];

Step 2: Register Notification in Class B.

[[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(GetData:) name:@”golferUpdate”object:nil];

Step 3: Add function GetData

-(void)GetData:(NSNotification *)notification{

    NSDictionary *dict = [notification userInfo];

// write your code Here




Step 4: Enjoy Coding………..

Best Of Luck.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: