通知中心与本地通知

  发送通知 

 [[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];

posted @ 2015-01-15 16:22  lss0209  阅读(175)  评论(0编辑  收藏  举报