Uikit--uidatadetectors (data detector) in iOS it turns the phone, mail, URL, etc. into a link

Source: Internet
Author: User

1. It is used for Uitextview and UIWebView, with the property name: Datadetetortypes

2. This property can be set to make text that matches the phone, mail, URL, date, and so on, into linked text.

3. When the phone number is clicked, the URL will open with Safari, the email will open with mail, and the format date will pop up with a actionsheet, create event, show in Calendar, and copy three options.

4. Examples of use:

  

Uitextview *textview = [[Uitextview alloc] Initwithframe:cgrectmake (20, 20, 280, 200)];

Textview.datadetectortypes = Uidatadetectortypeall;

Textview.font = [Uifont systemfontofsize:20];

textview.editable = NO;

Textview.text = @ "My phone nmuber is +8602980000000\r\n" "My web site was www.xxxxxx.com.\r\n" "My email-address is [email PR Otected] "" I was BORN in 1009-09-02 ";

Add a text view when the view

[Self.view Addsubview:textview];

 

The effect is as follows:

  

Uikit--uidatadetectors (data detector) in iOS it turns the phone, mail, URL, etc. into a link

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.