Openurl can help you run maps, SMS, browser, phone, and other applications.Program. This is a frequently used section in iPhone development.CodeIt only has one row.
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "Tel: // 8004664411"];
This program supports the call function through the basic protocol.
Attach:
-(Ibaction) openmaps {// open the map
// Where is apple on the map anyway?
Nsstring * addresstext = @ "1 infinite loop, Cupertino, CA 95014 ″;
Addresstext = [addresstext stringbyaddingpercentescapesusingencoding: nsasciistringencoding];
Nsstring * urltext = [nsstring stringwithformat: @ "http://maps.google.com/maps? Q = % @ ", addresstext];
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: urltext];
}
// Special encoding is required for directly searching Chinese locations on a map. The example is as follows:
-(Ibaction) gotohospitalmapaction: (ID) sednder
{
Nslog (@ "gotohospitalmapaction ");
Nsstring * strhospitaladdress = @ "No. 9, Wenxi West Road, shuiximen Street, Nanjing ";
Nsstring * strhospitalmap = @ "http://maps.google.com/maps? Q = ";
Nsurl * searchmap = [nsurl urlwithstring: [nsstring stringwithformat: @ "%", strhospitalmap,
[Strhospitaladdress stringbyaddingpercentescapesusingencoding: nsutf8stringencoding];
[[Uiapplication sharedapplication] Openurl: searchmap];
}
-(Ibaction) openemail {// open mail
// Fire off an email to Apple support
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "mailto: // devprograms@apple.com"];
}
-(Ibaction) openphone {// call
// Call the Google 411
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "Tel: // 8004664411"];
}
-(Ibaction) opensms {// open the text message
// Text to Google SMS
[[Uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "SMS: // 466453"];
}
-(Ibaction) openbrowser {// open the browser
// Lanuch any iPhone developers fav site
[[Uiapplication sharedapplication] Openurl [nsurl: urlwithstring: @ "http://itunesconnect.apple.com"];
}