iOS Development uiapplication

Source: Internet
Author: User

1 , overview

The UIApplication object is a symbol of the application. Each application has its own UIApplication object, and it is a singleton (only one object, we cannot create a new object, we can only get this object). This singleton object can be obtained by [UIApplication Sharedapplication]. a IOS the first object created after a program is started is uiapplication Object . With UIApplication objects, you can perform some application-level operations.

2 , uiapplication the Common Properties

1. Set the red reminder number in the upper right corner of the application icon

@property (nonatomic) Nsinteger applicationiconbadgenumber;

2, set the visibility of the network indicator

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

3 , iOS7 the status bar in

1 , the management of the status bar

Starting with IOS7, the system provides 2 ways to manage the status bar:

The first type:

Through Uiviewcontroller management (each uiviewcontroller can have its own different status bar).

The second type:

Managed by UIApplication (the status bar of an application is managed uniformly by it).

Use Uiviewcontroller to manage the status bar:

In IOS7, by default, the status bar is managed by Uiviewcontroller, and Uiviewcontroller can easily manage the visibility and style of the status bar by implementing the following methods:

(1) style of the status bar

-(Uistatusbarstyle) Preferredstatusbarstyle;

(2) Visibility of the status bar

-(BOOL) Prefersstatusbarhidden;

Using UIApplication to manage the status bar

Use uiapplication to manage the status bar:

If you want to use uiapplication to manage the status bar, you first have to modify the Info.plist settings.

You can then use UIApplication to manage the status bar:

For example: Use a fade-out animation effect to hide the status bar:

[App Setstatusbarhidden:yes Withanimation:uista Tusbaranimationfade];

Set the status bar style to white:

App.statusbarstyle = uistatusbarstylelightcontent;

Hide the status bar:

App.statusbarhidden = YES;

2 , OpenURL

UIApplication has a very powerful OpenURL: method

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

OpenURL: partial functionality of the method :

(1) Call

UIApplication *app = [UIApplication sharedapplication];

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

(2) Texting

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

(3) e-mail

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

(4) Open a webpage resource (auto jump to browser open)

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

(5) Open other apps

. . . . . . .

iOS Development uiapplication

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.