Created
August 29, 2012 14:50
-
-
Save polarity/3513744 to your computer and use it in GitHub Desktop.
NSNotificationCenter: postNotificationName
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
// Irgendeine Methode in irgendeiner Klasse | |
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
// Das aktuelle default NotificationCenter holen und in Variable "nc" referenzieren | |
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; | |
// Mit nc können wir jetzt.... | |
[nc | |
postNotificationName:@"goToProfile" // Alle Abonnenten (subscriber) von "goToProfile" informieren... | |
object:self // und uns selbst bzw. die Instanz dieser Klasse (self) als Objekt übergeben | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment