Skip to content

Instantly share code, notes, and snippets.

@polarity
Created August 29, 2012 14:50
Show Gist options
  • Save polarity/3513744 to your computer and use it in GitHub Desktop.
Save polarity/3513744 to your computer and use it in GitHub Desktop.
NSNotificationCenter: postNotificationName
// 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