美文网首页
iOS - webView检测电话和邮箱警告问题

iOS - webView检测电话和邮箱警告问题

作者: oneDemo | 来源:发表于2015-12-07 15:03 被阅读655次

    在 iOS 4之后。苹果废弃了 webView.detectsPhoneNumbers = YES; 这个方法来检测电话 号码。现在任然可以继续使用,但是会出现警告。

    更换为此方法:webView.dataDetectorTypes=UIDataDetectorTypePhoneNumber;

    API文档上如此

    typedefNS_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

    };

    相关文章

      网友评论

          本文标题:iOS - webView检测电话和邮箱警告问题

          本文链接:https://www.haomeiwen.com/subject/mnrehttx.html