Xcode 9 UITextView链接不再可单击 [英] Xcode 9 UITextView links no longer clickable
问题描述
在Xcode 9和iOS 11之前,我在 UITableViewCell
中包含一个 UITextView
,其中包含多个链接.每个链接均按预期工作,但是由于升级到iOS 11和Xcode 9,这些链接不再起作用.
Prior to Xcode 9 and iOS 11 I had a UITextView
within a UITableViewCell
that contained multiple links. Each link worked as expected, however since upgrading to iOS 11 and Xcode 9, the links no longer work.
UITextView似乎无法识别与 func textView(_ textView:UITextView,shouldInteractWith URL:URL,在characterRange:NSRange,交互作用:UITextItemInteraction)中的任何触摸交互->布尔
从不开火.
The UITextView doesn't appear to recognise any touch interaction with func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool
never firing.
升级后,还有其他人发现相同的问题吗?
Has anyone else found this same problem after upgrading?
推荐答案
结果证明这根本没有问题.UITextView在iOS11中响应触摸的方式发生了变化,这意味着单击链接需要更多的按下操作,而不仅仅是以前在iOS10中可用的轻按.我认为这可能与以下事实有关:在iOS11中,您现在可以按链接并拖动它们,这也会显示URL的详细信息.因此,UITextView需要更加坚定地按下以注册正在点击的链接.
Turns out there wasn't a problem after all. Changes in the way UITextView responds to touches in iOS11 means that clicking links requires more of a press rather than just a tap which previously worked in iOS10. I think this may be something to do with the fact that in iOS11 you can now press links and drag them which also displays details of URL. So a firmer press is needed for the UITextView to register the link being tapped.
这篇关于Xcode 9 UITextView链接不再可单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!