ios-simply talk about UIApplication

Source: Internet
Author: User

I. What is uiapplication

The 1.UIApplication object is the symbol of the application 2. Each application has its own UIApplication object, and it is a singleton 3. This singleton object 4 can be obtained by [UIApplication Sharedapplication]. The first object created after an iOS program is started is the UIApplication object 5. With UIApplication objects, we can do some application-level operations. Some of the applications that we see often are uiapplication controlled, For example 1. Set the red reminder number in the upper right corner of the application icon

@property (nonatomic) Nsinteger applicationiconbadgenumber;

2.N Setting the visibility of networking indicators

@property (nonatomic,getter=isnetworkactivityindicatorvisible) BOOL networkactivityindicatorvisible;

    

Two. Status bar in IOS7

1. Starting from IOS7, the system provides 2 ways to manage the status bar through Uiviewcontroller management (each uiviewcontroller can have its own different status bar) Through UIApplication Management (the status bar of an application is unified by it) 2 in IOS7, by default, the status bar is managed by Uiviewcontroller, Uiviewcontroller enables you to easily manage the visibility of the status bar and the style of the style status bar by implementing the following methods

-(Uistatusbarstyle) Preferredstatusbarstyle;

3 visibility of the status bar-(BOOL) Prefersstatusbarhidden; Note: If you want to use uiapplication to manage the status bar, you first need to modify the settings of the Info.plist three. UIApplication Important application-----UIApplication has a very powerful OpenURL: method

-(BOOL) OpenURL: (nsurl*) URL;

-nopenurl: Some of the functions of the method are 1. Call

UIApplication *app = [UIApplication sharedapplication];

[App Openurl:[nsurl urlwithstring:@ "tel://10086"];

2. Send SMS

[App Openurl:[nsurl urlwithstring:@ "sms://10086"];

3. Send an email

[App Openurl:[nsurl urlwithstring:@ "Mailto://[email protected]"];

4. Open a Web resource

[App Openurl:[nsurl urlwithstring:@ "http://ios.itcast.cn"];

5. Open Other apps 6 .... Four. UIApplication and delegate1. All mobile operating systems have a fatal disadvantage: apps are vulnerable to interruptions. For example, a call or a lock screen will cause the app to enter the background or even be terminated 2. There are many other similar situations that can cause the app to be disturbed, causing some system events when the app is disturbed, and UIApplication notifies its delegate object. Having the delegate agent handle these system events 3.delegate can handle events including:1> application lifecycle events (such as program startup and shutdown) 2> system events (such as incoming calls) 3> memory warning 4>

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.