SORU
9 Mayıs 2009, CUMARTESİ


Kakao Özel Bildirim Örneği

Biri bana nasıl ateş Kakao N-C nesne, özel bir bildirim ile, örnek göster, abone olmak, ve idare edebilir mi?

CEVAP
9 Mayıs 2009, CUMARTESİ


@implementation MyObject

// Posts a MyNotification message whenever called
- (void)notify {
  [[NSNotificationCenter defaultCenter] postNotificationName:@"MyNotification" object:self];
}

// Prints a message whenever a MyNotification is received
- (void)handleNotification:(NSNotification*)note {
  NSLog(@"Got notified: %@", note);
}

@end

// somewhere else
MyObject *object = [[MyObject alloc] init];
// receive MyNotification events from any object
[[NSNotificationCenter defaultCenter] addObserver:object selector:@selector(handleNotification:) name:@"MyNotification" object:nil];
// create a notification
[object notify];

Daha fazla bilgi için NSNotificationCenter belgelerine bakın.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • CasinoRoyaleMovie's channel

    CasinoRoyale

    1 AĞUSTOS 2006
  • habpsu

    habpsu

    25 Temmuz 2007
  • Jonathan Flavell

    Jonathan Fla

    1 HAZİRAN 2006