UITextView无法检测链接& iOS 7中的地址 [英] UITextView can not detect link & address in iOS 7

查看:174
本文介绍了UITextView无法检测链接& iOS 7中的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有支持iOS 6以及iOS 7的iOS应用程序。现在我在UITextView中显示包含电子邮件地址和文本的文本。网站网址。在iOS 6中,UITextView正确检测到它,但在iOS 7中,它不会检测何时加载视图。但是,当我点击任何链接,电子邮件地址时,它开始检测所有链接/网址。

I have iOS application which supports iOS 6 as well as iOS 7. Now I am showing text in UITextView which contains email address & website urls. In iOS 6 , UITextView detects it correctly but in iOS 7 it doesn't detect when view gets loaded. But when I click on any link , email address it starts detecting all the link / urls.

这是iOS 7中的错误还是我缺少一些专门针对iOS的设置7?以下是应用程序的屏幕截图

Is this a bug in iOS 7 or I am missing some settings specially for iOS 7 ? Below are the screenshots of app

1)在iOS 6+中加载视图时

1) In iOS 6+ when view loaded

2)在iOS 7中加载视图时

2) In iOS 7 when view loaded

3)在iOS 7中点击任何链接/电子邮件地址

3) In iOS 7 when I tap on any link / email address

4)以下是我在UITextView的界面构建器中所做的设置。

4) Here is the settings that I am doing in Interface builder for UITextView.

我查了一些链接,说明了,设置

I checked some links which states that , set

textView.text = nil;
textView.text = @"My required info";

但上面的代码没有运气。

But no luck with above code.

任何人都可以告诉我哪里出错了?谢谢

Can any body tell me whats going wrong ? Thanks

推荐答案

这似乎是iOS 7.0的UITextViews中的一个错误。您应该查看NSDataDetector。您可以使用它来查找链接,电话号码等 http://nshipster.com/nsdatadetector/

This appears to be a bug in iOS 7.0's UITextViews. You should check out NSDataDetector.You can use this to find links, phone numbers and more http://nshipster.com/nsdatadetector/

看来诀窍是 textView.scrollEnabled = NO 。似乎可以解决问题,但是如果你需要滚动。

It appears that the trick is to textView.scrollEnabled = NO. Seems to fix the problem, although if you need scrolling.

这篇关于UITextView无法检测链接& iOS 7中的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆