1 // 0. 获取应用程序的象征 2 UIApplication *app = [UIApplication sharedApplication]; 3 4 // 1.设置应用程序图标的提醒数字 5 app.applicationIconBadgeNumber = 10; 6 7 // 创建通知对象 8 UIUserNotificationSettings *setting = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil]; 9 10 // 注册用户通知 11 [app registerUserNotificationSettings:setting]; 12 13 // 2.设置联网的提示 14 app.networkActivityIndicatorVisible = YES; 15 16 // // 3.设置状态栏 17 // // 在iOS7之后,状态栏默认交给控制器的管理,可以在info.plist中把它交还给应用程序象征管理(在info.plist中添加一个KEY,选择最后一项,设置为NO) 18 app.statusBarHidden = YES; 19 [app setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; 20 21 // 4.打开网页 22 // URL:资源的唯一标示符 23 // http://www.baidu.com 24 // URL:协议头://资源路径 25 // 根据协议头判断用什么软件打开 26 27 /* 28 打电话 29 UIApplication *app = [UIApplication sharedApplication]; 30 [app openURL:[NSURL URLWithString:@"tel://10086"]]; 31 32 发短信 33 [app openURL:[NSURL URLWithString:@"sms://10086"]]; 34 35 发邮件 36 [app openURL:[NSURL URLWithString:@"mailto://12345@qq.com"]]; 37 38 打开一个网页资源 39 [app openURL:[NSURL URLWithString:@"http://ios.itcast.cn"]]; 40 41 **/ 42 43 44 // 创建URL 45 NSURL *url = [NSURL URLWithString:@"http://www.baidu.com"]; 46 47 [app openURL:url]; 48 49 50 // 隐藏状态栏 51 //- (BOOL)prefersStatusBarHidden 52 //{ 53 // return YES; 54 //}
浙公网安备 33010602011771号