(Material source code) IOS (21) UIApplication setting program icon on the upper right side of the red circle number _ ⽰, iosuiapplication

Source: Internet
Author: User

(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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.