Here are some of the features of this class:
1. Set the number icon on the icon
Set the digital icon on the main interface icon, introduced in 2.0, the default is 0
[Uiapplicationsharedapplication].applicationiconbadgenumber = 4;
2. Whether the Redo,undo action is supported when setting the shake gesture
Shake gesture, whether the redo undo operation is supported.
3.0 after introduction, default Yes
[Uiapplicationsharedapplication].applicationsupportsshaketoedit =yes;
3. Judging the state of the program operation
Determine the state of the program's operation and introduce it after 2.0
/*
Uiapplicationstateactive,
Uiapplicationstateinactive,
Uiapplicationstatebackground
*/
if ([Uiapplicationsharedapplication].applicationstate ==uiapplicationstateinactive) {
NSLog (@ "program in Operation State");
}
4. Prevent the screen from darkening into hibernation
Prevent screen from darkening, use cautiously, default to No 2.0
[Uiapplicationsharedapplication].idletimerdisabled =yes;
(Use this feature sparingly because it is very power-hungry)
5. Show Networking Status
Show Networking Tags 2.0
[Uiapplicationsharedapplication].networkactivityindicatorvisible =yes;
6. Show an address on the map
nsstring* addresstext [email protected] "1 Infinite Loop, Cupertino, CA 95014";
URL encode the spaces
Addresstext = [addresstextstringbyaddingpercentescapesusingencoding:nsasciistringencoding];
nsstring* Urltext = [nsstringstringwithformat:@ "http://maps.google.com/maps?q=%@", Addresstext];
[[Uiapplicationsharedapplication]openurl:[nsurlurlwithstring:urltext]];
7. Send an email
NSString *recipients [email protected] "Mailto:[email protected][email protected],[email Protected]&subject=hello From california! ";
NSString *body [email protected] "&body=it is raining in sunny california!";
NSString *email = [nsstringstringwithformat:@ "%@%@", recipients, body];
email = [Emailstringbyaddingpercentescapesusingencoding:nsutf8stringencoding];
[[Uiapplicationsharedapplication]openurl:[nsurlurlwithstring:email]];
8. Call a number
Call Google 411
[[uiapplicationsharedapplication]openurl:[nsurlurlwithstring:@ "tel://8004664411"]];
9. Send SMS
Text to Google SMS
[[uiapplicationsharedapplication]openurl:[nsurlurlwithstring:@ "sms://466453"]];
10. Open a URL
Lanuch any IPhone developers fav site
[[uiapplicationsharedapplication]openurl:[nsurlurlwithstring:@ "http://itunesconnect.apple.com"]];
Common use methods of UIApplication sharedapplication