问题描述
首次显示细节视图控制器时,inputAccessoryView将立即渲染文本,但是当您再次尝试重试时,直到动画完成后,文本才被渲染.
When showing the detail viewcontroller for the first time, the inputAccessoryView will render the text immediately, but when you go back and try it again, the text doesn't get rendered untill the animation completes.
在此处查看演示项目: https://github.com/SabatinoMasala/accessoryview-demo/
See demo project here:https://github.com/SabatinoMasala/accessoryview-demo/
如果有人有解决方案,解释或解决方法,我将很高兴听到它!
If anyone has a resolution, explanation or workaround, I'd be glad to hear it!
推荐答案
我遇到了同样的问题,并且找到了一个更简单的解决方法.似乎该错误与inputAccessoryView动画正在使用视图的快照这一事实有关.强制显示快照即可解决问题:
I've been experiencing the same issue and I found a simpler workaround. It seems that this bug is related to the fact that inputAccessoryView animation is using a snapshot of the view. Forcing the snapshot appears to resolve the issue:
let _ = accessoryView.snapshotViewAfterScreenUpdates(true)
这篇关于UITextView作为InputAccessoryView直到动画后才呈现文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!