推送:本地推送。启动画面的设置
1.找到appdelegate
1-1.首先注册推送的功能
第一个弹出文字,第二个,应用图标右上角的数字,第三个,推送的声音
UIUserNotificationType type = UIUserNotificationTypeAlert |UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
1-2.UIUserNotificationSettings *setting = [UIUserNotificationSettings settingsForTypes:type categories:nil];
1-3.注册
[[UIApplication sharedApplication]registerUserNotificationSettings:setting];
1-4.调用一个代理方法.
//注册成功时候去调用
-(void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
//点击通知的时候调用
-(void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void (^)())completionHandler;
2.找到ViewController
2-1.创建一个本地通知的对象
UILocalNotification *n = [[UILocalNotification alloc]init];
2-2.设置时区
n.timeZone = [NSTimeZone defaultTimeZone];
2-3.通知的间隔
n.repeatInterval = NSCalendarUnitMinute;
2-4.发送通知的时间
n.fireDate = [NSDate dateWithTimeIntervalSinceNow:10];
2-5.通知的标题
n.alertTitle = @"吃药提醒";
2-6.通知的文字
n.alertBody = @"该吃药了";
2-7.图标
n.applicationIconBadgeNumber = 1;
2-8.声音,也可以加本地的声音
n.soundName = UILocalNotificationDefaultSoundName;
2-9.点击启动消息时候,启动画面
n.alertLaunchImage = @"1.png";
2-10.发送通知,定时发送,不是立即发送
[[UIApplication sharedApplication]scheduleLocalNotification:n];
2-11.立即发送通知
[UIApplication sharedApplication];
2-12.取消通知
[[UIApplication sharedApplication]cancelLocalNotification:n];
2-13.取消全部通知
[[UIApplication sharedApplication]cancelAllLocalNotifications]
3.
启动画面的设置,xcode6.3在LaunchScreen.xib里面设置图片即可
设置启动时长[NSThread sleepForTimeInterval:10];