Created
July 2, 2015 06:33
-
-
Save bestimmaa/c4ef9d15b9e354d0da8b to your computer and use it in GitHub Desktop.
iOS - Post and subscribe to NSNotification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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