[英]UITextView stange animation glitch on paste action (iOS11)
I'm facing a very strange bug. 我面临一个非常奇怪的错误。 When I paste anything inside
UITextView
, I receive a surprising glitch of animation. 当我在
UITextView
粘贴任何内容时,我会收到令人惊讶的动画故障。
To reproduce it I've just created a black .xcodeproj
, added UITextView
to ViewController
via storyboard and ran the application. 为了重现它,我刚刚创建了一个黑色的
.xcodeproj
,并通过情节.xcodeproj
将UITextView
添加到ViewController
并运行了该应用程序。
The only similiar problem I've found is https://twitter.com/twostraws/status/972914692195790849 And it says that it's a bug of UIKit
in iOS11. 我发现的唯一类似问题是https://twitter.com/twostraws/status/972914692195790849并且它说这是iOS11中
UIKit
的错误。 But there lot of applications on my iPhone with UITextview
that works correctly on iOS11. 但是我的iPhone上有很多带有
UITextview
的应用程序,它们可以在iOS11上正常工作。 You can see the bug in the video here – https://twitter.com/twostraws/status/972914692195790849 您可以在此处的视频中看到错误-https: //twitter.com/twostraws/status/972914692195790849
Any suggestions or help would be appreciated. 任何建议或帮助,将不胜感激。 What I tried?
我尝试了什么? - Tried the new clear project with minimal changes;
-尝试以最小的更改进行新的清晰项目; - Disabled all the autocorrection types;
-禁用所有自动更正类型; - Removed constraints;
-消除了限制; - Tried on several iPhones with different version – 11.2.5 and 11.4.2.
-在具有不同版本(11.2.5和11.4.2)的多个iPhone上试用。
The original project is attached. 原始项目已附加。 It's made on
Swift 4.1
with Xcode 9.4(9F1027a)
https://ufile.io/fzyj8 它是使用
Xcode 9.4(9F1027a)
在Swift 4.1
上制作的https://ufile.io/fzyj8
I checked some other applications on my iPhone like Todoist
and found the same bug there. 我检查了iPhone上的其他应用程序,例如
Todoist
并在其中发现了相同的错误。 But also I've found the solution. 但我也找到了解决方案。 I hope Apple will urgently fix this bug.
我希望苹果公司能够紧急修复此错误。
So you may implement the UITextPasteDelegate
and disabled the animation on paste action. 因此,您可以实现
UITextPasteDelegate
并禁用粘贴动画。 This API is available only iOS11+, but it seems that the bug is also reproduced only on iOS11. 该API仅在iOS11 +上可用,但似乎该错误也仅在iOS11上重现。
class ViewController: UIViewController {
@IBOutlet weak var textView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
textView.pasteDelegate = self
}
}
extension ViewController: UITextPasteDelegate {
func textPasteConfigurationSupporting(_ textPasteConfigurationSupporting: UITextPasteConfigurationSupporting, shouldAnimatePasteOf attributedString: NSAttributedString, to textRange: UITextRange) -> Bool {
return false
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.