How to call a function using NSNotification on custom Event.

Step 1. In viewDidLoad   // add notification

– (void)viewDidLoad
    [super viewDidLoad];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MoveToNextView:) name:@”SomeNotificationName” object:nil];
    // Do any additional setup after loading the view, typically from a nib.

Step 2:  call Notification function

      [[NSNotificationCenter defaultCenter] postNotificationName:@”SomeNotificationName” object:nil];

step 3.

    UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@”Alert” message:@”Notification Alert” delegate:self cancelButtonTitle:@”Cancel” otherButtonTitles:@”ok”, nil];
    [alert show];



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

Create a free website or blog at

Up ↑

%d bloggers like this: