码迷,mamicode.com
首页 > 其他好文 > 详细

通知中心与本地通知

时间:2015-01-15 17:47:42      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

  发送通知 

 [[NSNotificationCenter defaultCenter]postNotificationName:@"change" object:nil];

注册通知

[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(changeCount) name:@"change" object:nil];

 UILocalNotification *local=[[UILocalNotification alloc]init];

    //设置时间

    local.fireDate=[[NSDate date]dateByAddingTimeInterval:0.5];

    //设置时区

    local.timeZone=[NSTimeZone defaultTimeZone];

    //设置内容

    local.alertBody=@"本地通知";

    //设置声音

    local.soundName=UILocalNotificationDefaultSoundName;

    //设置图标

    local.applicationIconBadgeNumber=10;

    

    [[UIApplication sharedApplication]scheduleLocalNotification:local];

通知中心与本地通知

标签:

原文地址:http://www.cnblogs.com/zhuzhushen/p/4226614.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!