Use of Openurl (IOS calls system phones, browsers, maps, emails, etc)

Source: Internet
Author: User

Today, I met a line of code to open a webpage, which is much easier to implement than the uiwebview control in my impression. It is easy to use and can be easily used after real machine testing, I searched for some related information on the Internet:


Code segment: [[uiapplication sharedapplication] Openurl: url];


The system URL includes:
1. Map http://maps.google.com/maps? Q = Shanghai
2. email mailto: // myname@google.com
3. Tel: // 10086
4. msg sms: // 10086
 


-(Ibaction) openmaps {// open the map nsstring * addresstext = @ "Beijing"; // @ "1 infinite loop, Cupertino, CA 95014"; addresstext = [addresstext failed: nsasciistringencoding]; nsstring * urltext = [nsstring stringwithformat: @ "http://maps.google.com/maps? Q = % @ ", addresstext]; nslog (@" urltext =====================%@ ", urltext ); [[uiapplication sharedapplication] Openurl: [nsurl urlwithstring: urltext];}-(ibaction) openemail {// open mail // fire off an email to Apple support [[uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "mailto: // devprograms@apple.com"];} -(ibaction) openphone {// call Google 411 [[uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "Tel: // 10086"];} -(ibaction) opensms {// open the text message // text togoogle SMS [[uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "SMS: // 10086"];} -(ibaction) openbrowser {// open the browser // lanuch any iPhone developers fav site [[uiapplication sharedapplication] Openurl: [nsurl urlwithstring: @ "http://blog.csdn.net/duxinfeng2010"];}

Reference http://www.cocoachina.com/bbs/read.php? Tid = 73570 & page = 3


Related Article

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.