Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

NSNotificationCenter Tutorial

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
559 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Nov 29, 2011

Easy example using a very powerful tool, the NSNotificationCenter
https://github.com/iElmo/NSNotificationCenter-

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (iElmoTutorials)

  • nice tutorial. Could I NSNotification to change an image of a UIIMageView from a button on another ViewController?

  • @Nateddnd Hi glad you found it useful :)

    To answer your question yes you can but what is your set up.NSNotificication is 12 kinds of awesome but updating the UI is more a delegate role.

    PM me in more detail and we can talk

  • Helped me quite a bit,Thanks

  • @vinayutubeaccount No problem, glad it helped

see all

All Comments (9)

Sign In or Sign Up now to post a comment!
  • Thanks for the tutorial

    Can an NSNotification send a data parameter to the listener?

  • @cuongchanluong Yep you can, just make sure of one important thing, well two actually. (And call reloadData if its a tableView)

    If adding a new date etc id use presentModalViewController to pop a temp view onto the calendar viewcontroller, this gives you an easy dismiss feature plus looks cool.

    Second is to make sure to [[NSNotificationCenter defaultCenter] removeObserver:self]; in the viewDidUnload because if your addObserver is in the viewDidLoad it'll keep adding observers.

  • @iElmoTutorials I'm trying to pass data between viewcontroller that's on a navigationviewcontroller stack (ie. in a calendar app how you add a date and select the start/end date on the next screen, and it gets set on the previous screen). One way is to do it with delegate but it's more hassle than with the notificationcenter.

  • @cuongchanluong Heya, glad you enjoyed it!

    With regards to your question, are you talking about another navigation stack you want to send data to? NSNotification can send to anywhere anytime. But beware that adding observers uses memory AND if your classes(especially viewcontrollers) are constantly being re used then observers will keep getting added! So beware :)

    That answer you question?

  • Great tutorial!

    Can I use NSNotificationCenter to pass data between viewControllers in a navigationController stack? Thanks!

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more