UIApplication is a system singleton that has only one piece of memory, no matter when the program is created. Its application is: Set the mobile phone desktop app icon on the number of messages displayed on the alert, you can monitor the network status, call, open the page, control status bar and so on.
1,app a message reminder number.
Can do this: [UIApplication sharedapplication].applicationiconbadgenumber = 10;
Note: Set this to require app registration push notification Service: [UIApplication sharedapplication]registernotificationsettings:[uiusernotifications Settingfortype:uiusernotificationtypebadge Categories:nil];
2. Set the networking status.
[UIApplication sharedapplication]. networkactivityindicatorvisible = YES; Set this, when the program is networked, the status bar will have a chrysanthemum in turn.
3, you can open the Web page (call the same)
[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "http://www.baidu.com"]; Can be placed in the button click Method, when clicked on the button, directly open the specified page.
4. Control the status bar to hide or change the style.
First note: After iOS7, the status bar is managed by the controller by default, that is, the controller automatically calls Preferstatusbarhidden this method to determine whether the current controller's status bar is hidden. But each controller needs to be set up, which is more troublesome. Can be handed to uiapplication management, need to add field in Info.plist View Controller based status bar appearance set to No, indicating that the status bar does not need to be controlled by the controller. Then you can use UIApplication to manage the status bar. As follows:
[[UIApplication sharedapplication] setstatusbarhidden:yes];
Introduction and application of UIApplication