(Material source code) IOS (21) UIApplication setting program icon on the upper right side of the red circle number _ ⽰, iosuiapplication
CAT/CAT sharing, must be excellent
Material address: http://download.csdn.net/detail/u013357243/8602889
For Original Articles, please reprint them. Reprinted Please note: Yan Nai-yu's blog
Http://blog.csdn.net/u013357243? Viewmode = contents
Effect
Source code
/// NJViewController. m // 06-UIApplication /// Created by apple on 14-6-3. // Copyright (c) 2014 heima. all rights reserved. // # import "NJViewController. h "@ interface NJViewController () @ end @ implementation NJViewController-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. // UIApplication * app = [UIApplication sharedApplication]; // UIApplication * app1 = [UIApplication sharedApplication]; // UIApplication * app2 = [[UIApplication alloc] init]; // NSLog (@ "% p-% p", app, app1); UIButton * btn = [[UIButton alloc] initWithFrame: CGRectMake (100,100,100,100)]; [btn setTitle: @ "Click me" forState: UIControlStateNormal]; [btn addTarget: self action: @ selector (onClick) forControlEvents: UIControlEventTouchUpInside]; btn. backgroundColor = [UIColor redColor]; [self. view addSubview: btn];}-(void) onClick {// NSLog (@ "clicked"); UIApplication * app = [UIApplication sharedApplication]; // set the number on the application icon // app. applicationIconBadgeNumber = 998; // sets the online animation of the status bar. // app. networkActivityIndicatorVisible = YES; // set the style of the status bar // app. statusBarStyle = UIStatusBarStyleLightContent; // [app setStatusBarStyle: UIStatusBarStyleLightContent animated: YES]; // sets whether the status bar is hidden. // app. statusBarHidden = YES; // [app setStatusBarHidden: YES withAnimation: UIStatusBarAnimationFade];/* URL: Uniform Resource Locator, which uniquely represents a resource URL: protocol header: // host address/resource path network resource: http://www.baidu.com/images/20140603/abc.png local resource: file: // users/apple/desktop/abc.png */NSURL * url = [NSURL URLWithString: @ "http://www.baidu.com"]; [app openURL: url];} //-(UIStatusBarStyle) preferredStatusBarStyle // {// return UIStatusBarStyleLightContent; //} // (BOOL) prefersStatusBarHidden // {// return YES; //} @ end
Ps: new iOS communication learning group: 304570962 can be added to cat qq: 1764541256 or znycat. Let's study hard together.
Yan Nai-yu's blog
Http://blog.csdn.net/u013357243? Viewmode = contents