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

  • MW Technology

    MW Technolog

    28 EKİM 2009
  • NewsyTech

    NewsyTech

    2 AĞUSTOS 2010
  • Ownage Pranks

    Ownage Prank

    13 AĞUSTOS 2007