[Basic iOS control and basic ios Control

Source: Internet
Author: User

[Basic iOS control and basic ios Control
A. Concept1. the UIApplication object is a symbol of an application. Each application has 2. singleton 3. [UIApplication sharedApplication] Get 4. the first object created at iOS startup 5. use UIApplication to perform application-level operationsB. Use1. The message count icon of the app prompts

1 // 1. obtain UIApplication 2 UIApplication * app = [UIApplication sharedApplication]; 3 4 // 2.1 authorization. After iOS8, you must first authorize the operation to modify the information notification number, determine whether the system is iOS8 before authorization. Otherwise, the system before iOS8 may encounter an error 5 if (_ IPHONE_ OS _VERSION_MIN_REQUIRED> = 80000) {6 NSLog (@ "iOS8 supported-system version: % d ", _ ication); 7 8 UIUserNotificationSettings * settings = [UIUserNotificationSettings settingsForTypes: UIUserNotificationTypeBadge categories: nil]; 9 [app registerUserNotificationSettings: settings]; 10 11} 12 13 // 2.2 icon information notification number 14 app. applicationIconBadgeNumber = 10;
1 // 4. open URL Resource 2/** 3 *, which can be a local resource file: /// Users/hellovoidworld/Pictures/G1/M2.jpg omitted host address 4 * can also be a network resource http://www.baidu.com 5 * call tel: // 10086 6 * sms: // 10086 7 * mail mailto: // 12345@qq.com 8 * The system selects the open mode 9 */10 NSLog (@ "Open url") based on the resource type; 11 [app openURL: [NSURL URLWithString: @ "http://www.baidu.com"]; # Mark : I tried to open the local file but it didn't respond.4. communication with other apps (not detailed here) 5. after managing the status bar iOS7, you can also use the controller to manage the status bar. All controllers can control the status bar. This is the default control method. Before that, UIApplication is the only method to control the status bar, to perform configuration conversion (no controller is used for control) 1 // 5. manage status bar 2 // 5.1 hide status bar 3 using animation effects // [app setStatusBarHidden: YES withAnimation: UIStatusBarAnimationFade]; 4 5 // 5.2 use the animation effect to change the status bar to white 6 [app setStatusBarStyle: UIStatusBarStyleLightContent animated: YES];

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.