iphone development-uiwebview Turn off auto-detect data

Source: Internet
Author: User

If you have a paragraph in your Web page, the content of the middle content is Www.yesareno.com,UIWebview will automatically identify you as http:// Www.yesareno.com, of course, most of the cases are good, but there are some special cases, you do not like the www.yesareno.com to identify as hyperlinks (that is, click No response, regardless of the abnormal needs of it), how to achieve it?

</pre><p></p><p> below is the source code for the Web page: </p><p></p><pre name= "code" class= "HTML" ><body><div id= "Content" ><p><span style= "font-family: Microsoft Ya hei, ' Microsoft Yahei '; font-size:28px; " > If you need help, please go to the official website www.yesareno.cn resolve. </span></p><p><br/></p></div></body>

When you click Www.yesareno.com in the Web page, the WebView proxy is called:

(BOOL) WebView: (UIWebView *) WebView shouldstartloadwithrequest: (nsurlrequest *) Request Navigationtype: ( Uiwebviewnavigationtype) Navigationtype {//Determine if we want the system to handle it. Nsurl *url = Request. URL;}

At this point the print Url.schema is HTTP, which is the HTTP WebView added. How is that broken?

After reviewing the document, it was found that WebView has a property that automatically detects the data, that is, Datadetectortypes, which includes

typedef ns_options (Nsuinteger, uidatadetectortypes) {    Uidatadetectortypephonenumber   = 1 << 0,          // Phone number detection    uidatadetectortypelink          = 1 << 1,          //URL detection    #if __iphone_4_0 <= __ iphone_os_version_max_allowed    uidatadetectortypeaddress       = 1 << 2,          //Street address detection    uidatadetectortypecalendarevent = 1 << 3,          //Event detection#endif        Uidatadetectortypenone          = 0,               //No detection at all    uidatadetectortypeall           = Nsuintegermax    //All types};
See these, presumably everybody already understood half of it, the simplest rough way is to set the Datadetectortypes property to Uidatadetectortypenone can be.

Then run the program, click Www.yesareno.com, will not jump.

Little tricks, essays are recorded.

iphone development-uiwebview Turn off auto-detect data

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.