UIApplication的作用--演示:
- (void)viewDidLoad {
[superviewDidLoad];
UIApplication*app = [UIApplicationsharedApplication];
UIUserNotificationSettings*settings = [UIUserNotificationSettingssettingsForTypes:UIUserNotificationTypeBadgecategories:nil];
//注册通知
[appregisterUserNotificationSettings:settings];
//1.设置应用程序图标提醒数字
app.applicationIconBadgeNumber=0;
//2.设置联网状态
app.networkActivityIndicatorVisible=YES;
//3.设置状态栏
//在iOS7之后状态栏都是交给控制器管理,不用下方的代码了。
app.statusBarHidden = YES;
[app setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
//4.打电话,发短信,打开网页.
URL:资源唯一路径
//http://www.baidu.com
//URL:协议头//路径// http://
//其实苹果就是根据协议头判断用什么软件去打开
NSURL*url = [NSURLURLWithString:@"http://www.baidu.com"];
[appopenURL:url];
}
//隐藏状态栏
-(BOOL)prefersStatusBarHidden
{
return YES;
}