2012-08-30 9 views
6

Estoy hablando de esto: http://reviews.cnet.com/8301-19512_7-20120625-233/ios-5-notifications-a-deeper-look/iOS 5 "Centro de notificaciones" API?

Esos menús desplegables en IOS, que por el amor de la vida no se puede encontrar ninguna documentación sobre cómo hacer una notificación para que muestre una actualización mientras que en otra aplicación. No sé si estoy usando la terminología equivocada o qué, pero ¿es "NSNotificationCenter" y dónde está la documentación?

Gracias :)

+2

UILocalNotification? –

+0

NSNotificationCenter es algo completamente diferente. –

+0

UILocalNotification pone un "1" en un cuadro rojo junto al nombre de mi aplicación, no marca un banner ... –

Respuesta

5

La insignia numérica no es la única propiedad de una notificación local. También puede mostrar pancartas y reproducir sonidos. Estos banners se agregan posteriormente al centro de notificaciones.

He aquí un ejemplo:

- (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]; 
} 

Y aquí es un tutorial: http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/

+0

¡Muchas gracias! :) –

Cuestiones relacionadas