//隐藏状态栏-(BOOL)prefersStatusBarHidden
{
return NO;
}
//设置状态栏的样式
-(UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
-(BOOL)openURL:(NSURL*)url;
以下是代码的具体体现:
1 #import "ViewController.h" 2 3 @interface ViewController () 4 5 @end 6 7 @implementation ViewController 8 9 - (void)viewDidLoad { 10 [super viewDidLoad]; 11 // Do any additional setup after loading the view, typically from a nib. 12 [self.view setBackgroundColor:[UIColor blackColor]]; 13 } 14 15 - (void)didReceiveMemoryWarning { 16 [super didReceiveMemoryWarning]; 17 // Dispose of any resources that can be recreated. 18 } 19 //每一个视图控制器单独控制自己的状态栏 20 //隐藏状态栏 21 -(BOOL)prefersStatusBarHidden 22 { 23 return NO; 24 } 25 26 //设置状态栏的样式 27 -(UIStatusBarStyle)preferredStatusBarStyle 28 { 29 return UIStatusBarStyleLightContent; 30 } 31 @end
Application对象完成的各种功能:
1 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 2 // Override point for customization after application launch. 3 4 //在iOS8中,必须经过用户允许才能设置badge/alert/sound 5 UIUserNotificationSettings *setting = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge |UIUserNotificationTypeAlert | UIUserNotificationTypeSound categories:nil]; 6 7 UIApplication *app = [UIApplication sharedApplication]; 8 [app registerUserNotificationSettings:setting]; 9 10 //设置应用程序图标上显示的提醒数字 11 app.applicationIconBadgeNumber = 10; 12 13 //设置联网指示器的可见性(默认是NO) 14 app.networkActivityIndicatorVisible = YES; 15 16 //设置状态栏的样式 17 app.statusBarStyle = UIStatusBarStyleLightContent; 18 19 //隐藏状态栏 20 app.statusBarHidden = NO; 21 22 //openURL功能(URL统一资源定位符) 23 //1.打电话 24 [app openURL:[NSURL URLWithString:@"tel://10086"]]; 25 26 //2.发短信 27 [app openURL:[NSURL URLWithString:@"sms://10086"]]; 28 29 //3.发邮件 30 [app openURL:[NSURL URLWithString:@"mailto://1360074459@qq.com"]]; 31 32 //4.打开网络资源 33 [app openURL:[NSURL URLWithString:@"http://www.baidu.com"]]; 34 35 //5.打开其他的应用程序 36 [app openURL:[NSURL URLWithString:@"prefs:"]]; 37 38 return YES; 39 }