简体   繁体   English

iOS 5“通知中心”API?

[英]iOS 5 “Notification Center” API?

I'm talking about this: http://reviews.cnet.com/8301-19512_7-20120625-233/ios-5-notifications-a-deeper-look/ 我在谈论这个: http//reviews.cnet.com/8301-19512_7-20120625-233/ios-5-notifications-a-deeper-look/

Those pulldown menus on iOS, I for the love of life cannot find any documentation on how to make a notification so that it shows an update while in another application. iOS上的那些下拉菜单,我对生活的热爱找不到任何关于如何发出通知的文档,以便在另一个应用程序中显示更新。 I don't know if I just am using the wrong terminology or what, but is it "NSNotificationCenter", and where is any documentation on it? 我不知道我是在使用错误的术语还是什么,但是它是“NSNotificationCenter”,它的文档在哪里?

Thanks :) 谢谢 :)

The numerical badge isn't the only property of a local notification. 数字徽章不是本地通知的唯一属性。 It can also display banners, and play sounds. 它还可以显示横幅和播放声音。 These banners are subsequently added to notification center. 随后将这些横幅添加到通知中心。

Here's an example: 这是一个例子:

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

And here's a tutorial: http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/ 这是一个教程: http//www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM