Skip to content

Instantly share code, notes, and snippets.

@bestimmaa
Created July 2, 2015 06:33
Show Gist options
  • Save bestimmaa/c4ef9d15b9e354d0da8b to your computer and use it in GitHub Desktop.
Save bestimmaa/c4ef9d15b9e354d0da8b to your computer and use it in GitHub Desktop.
iOS - Post and subscribe to NSNotification
// declare notification name in something.h
extern NSString* const touchEndNotification;
// define notification name in something.m
NSString* const touchEndNotification = @"StimulusRotationDidEnd";
// post notification
[[NSNotificationCenter defaultCenter] postNotificationName:touchEndNotification object:self];
// subscribe to notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateSurfaceView) name:touchEndNotification object:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment