View Plaincopy to Clipboardprint?
- [[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:appstring]];
[[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:appstring]];
Among the system's appstring are:
View Plaincopy to Clipboardprint?
- Map Http://maps.google.com/maps?q=Shanghai
- Email Mailto://[email protected]
- Tel tel://10086
- MSG sms://10086
Map Http://maps.google.com/maps?q=Shanghai
Email Mailto://[email protected]
Tel tel://10086
MSG sms://10086
In addition to this, you can also define your own URL by:
View Plaincopy to Clipboardprint?
- Open info.plist, add a URL types
- Expand URL Types, expand Item1, and change the URL identifier under ITEM1 to URL Scheme
- Expand URL Scheme To modify the contents of Item1 to MyApp
- Other programs can access this custom URL through myapp://
Open info.plist, add a URL types expand the URL types, expand Item1, change the URL Item1 under identifier to URL scheme, expand URL Scheme, modify the contents of Item1 to MyApp Other programs can access this custom URL through myapp://
Resources:
P.P1 {margin:0.0px 0.0px 0.0px 0.0px; font:14.0px Menlo}
Http://iphonedevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html
OpenURL can help you run Maps,sms,browser,phone and even other applications. This is a piece of code that I often need to use in iphone development, and it's just a single line.
View Plaincopy to Clipboardprint?
- -(ibaction) Openmaps {
- Open map
- NSString *addresstext = @ "Beijing";//@ "1 Infinite Loop, Cupertino, CA 95014";
- Addresstext = [Addresstext stringbyaddingpercentescapesusingencoding:nsasciistringencoding];
- NSString *urltext = [NSString stringwithformat:@ "http://maps.google.com/maps?q=%@", Addresstext];
- NSLog (@ "Urltext ===============%@", urltext);
- [[UIApplication sharedapplication] Openurl:[nsurl Urlwithstring:urltext]];
- }
-(ibaction) Openmaps {
Open map
NSString *addresstext = @ "Beijing";
@ "1 Infinite Loop, Cupertino, CA 95014";
Addresstext = [Addresstext stringbyaddingpercentescapesusingencoding:nsasciistringencoding];
NSString *urltext = [NSString stringwithformat:@ "http://maps.google.com/maps?q=%@", Addresstext];
NSLog (@ "Urltext ===============%@", urltext);
[[UIApplication sharedapplication] Openurl:[nsurl Urlwithstring:urltext]];
}
View Plaincopy to Clipboardprint?
- -(ibaction) Openemail {
- Open Mail
- Fire off a email to Apple support
- [[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:@ "Mailto://[email protected]"];
- }
-(ibaction) Openemail {
Open mail/Fire off a email to Apple support
[[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:@ "Mailto://[email protected]"];
}
View Plaincopy to Clipboardprint?
- -(ibaction) Openphone {
- Dial number
- Call Google 411
- [[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "tel://8004664411"];
- }
-(ibaction) Openphone {
Dial number
Call Google 411
[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "tel://8004664411"];
}
View Plaincopy to Clipboardprint?
- -(ibaction) opensms {
- Open sms
- Text to Google SMS
- [[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "sms://466453"];
- }
-(ibaction) opensms {
Open sms
Text to Google SMS
[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "sms://466453"];
}
View Plaincopy to Clipboardprint?
- -(ibaction) Openbrowser {
- Open your browser
- Lanuch any IPhone developers fav site
- [[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "http://itunesconnect.apple.com"];
- }
-(ibaction) Openbrowser {
Open your browser
Lanuch any IPhone developers fav site
[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "http://itunesconnect.apple.com"];
}
Transferred from: http://blog.sina.com.cn/s/blog_6c515d5a01010e5p.html
(go) How to use OpenURL