2012-08-30 5 views
6

Je parle de ceci: http://reviews.cnet.com/8301-19512_7-20120625-233/ios-5-notifications-a-deeper-look/iOS 5 API "Centre de notifications"?

Les menus déroulants sur iOS, I pour l'amour de la vie ne peut pas trouver de la documentation sur la façon de procéder à une notification afin qu'il présente une mise à jour alors que dans une autre application. Je ne sais pas si j'utilise la mauvaise terminologie ou quoi, mais est-ce que c'est "NSNotificationCenter", et où est la documentation?

Merci :)

+2

UILocalNotification? –

+0

NSNotificationCenter est quelque chose de complètement indépendant. –

+0

UILocalNotification met un "1" dans une boîte rouge par mon nom d'application, ne marque pas une bannière ... –

Répondre

5

Le badge numérique n'est pas la seule propriété d'une notification locale. Il peut également afficher des bannières et jouer des sons. Ces bannières sont ensuite ajoutées au centre de notification.

Voici un exemple:

- (void)addNotification { 
    UILocalNotification *localNotification = [[UILocalNotification alloc] init]; 
  
    localNotification.fireDate = self.datePicker.date; 
    localNotification.alertBody = self.messageField.text; 
    localNotification.soundName = UILocalNotificationDefaultSoundName; 
    localNotification.applicationIconBadgeNumber = 1; 
  
    NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Object 1", @"Key 1", @"Object 2", @"Key 2", nil]; 
    localNotification.userInfo = infoDict; 
  
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 
    [localNotification release]; 
} 

Et voici un tutoriel: http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/

+0

Merci beaucoup! :) –

Questions connexes