HI,NSNotification-implémentation pour d'autres événements de classe?
dans mon ViewController.mi've a ajouté un NSNotification dans "viewDidLoad" comme ceci:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(pageControlChanged:)
notificationName:@"ScrollViewDidEnd"
object:nil];
Puis une coutume ScrollView Ive classe "MyScrollView" où je peux faire défiler une image . J'ai ajouté un postNotification quand la méthode "scrollViewDidEndDecelerating: (UIScrollView *) scrollView {.." est appelée.
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
[[NSNotificationCenter defaultCenter] postNotificationName:@"ScrollViewDidEnd" object:nil];
}
- (void) pageControlChanged:(NSNotification*)notification{
NSLog(@"pagecontrol: %@", notification);
}
Quand je compile mon projet, je reçois une erreur et les plantages d'applications: Console sortie: "Non addObserver: sélecteur: notifcatonName: objet:" méthode trouvée. Donc, c'est ma première utilisation de NSNotification, ce serait bien d'avoir de l'aide ici. Merci pour votre temps. Yosh
Oh putain .. Si bête. Merci pour cette aide. Ça marche ;) – geforce