使 UITextField 不绘制图像附件但保留其框架
Make UITextField not to draw image attachment but keep its frame
UITextField
在 iPhone 6+/6s+ 滚动时绘制图像附件的性能非常差。我正在研究一些子视图解决方案,以将附件与 UIImageView
s 重叠。它运行良好,但我需要 UITextView
停止绘制此附件,但将附件框架保留在它们的位置。
我知道 NSTextContainer
exclusionPaths
属性,但不确定它是否适用于异步图像加载。图片大小下载后就知道了。
通过取消 [NSTextAttachment image]
和恢复边界找到了可行的解决方案:
CGRect bounds = attachment.bounds;
attachment.image = nil;
attachment.bounds = bounds;
UITextField
在 iPhone 6+/6s+ 滚动时绘制图像附件的性能非常差。我正在研究一些子视图解决方案,以将附件与 UIImageView
s 重叠。它运行良好,但我需要 UITextView
停止绘制此附件,但将附件框架保留在它们的位置。
我知道 NSTextContainer
exclusionPaths
属性,但不确定它是否适用于异步图像加载。图片大小下载后就知道了。
通过取消 [NSTextAttachment image]
和恢复边界找到了可行的解决方案:
CGRect bounds = attachment.bounds;
attachment.image = nil;
attachment.bounds = bounds;