UITextField
在iPhone 6+/6s+上滚动时绘制图像附件的性能非常差。我正在研究一些子视图解决方案,以重叠附件与UIImageView
s。它工作得很好,但我需要UITextView
停止绘制这个附件,但保持附件框架在他们的地方。
我知道NSTextContainer
exclusionPaths
属性,但不确定它会很好地用于异步图像加载。图片大小将在下载后显示
通过填充[NSTextAttachment image]
和恢复边界找到工作解决方案:
CGRect bounds = attachment.bounds;
attachment.image = nil;
attachment.bounds = bounds;