renderInContext 无法渲染宽度大于 512 像素的 UIView
我有一个宽度超过 600 像素的视图层次结构。在该层次结构中,我有一个 UITextView。一切都正确显示在屏幕上。
然后,我尝试从该视图创建图像:
CGSize size = mainView.bounds.size;
UIGraphicsBeginImageContextWithOptions(size, YES, 1.0);
[[mainView layer] renderInContext:UIGraphicsGetCurrentContext()];
这在大多数情况下都有效。
但是,如果 UITextView 宽度超过 512 像素,则不会绘制文本。视图本身是可见的(您可以看到背景),但没有文本。
这是 OS4 和 OS5 上的。
我认为这是一个错误,但我迫切需要一个解决方法。有人见过这个吗?
蒂姆
I have a view hierarchy that's over 600 pixels wide. Inside that hierarchy I have a UITextView. Everything displays correctly on screen.
I then try to create an image from that view:
CGSize size = mainView.bounds.size;
UIGraphicsBeginImageContextWithOptions(size, YES, 1.0);
[[mainView layer] renderInContext:UIGraphicsGetCurrentContext()];
This works for the most part.
However, if the UITextView is wider than 512 pixels then the text isn't drawn. The view itself is visible (you can see the background), but there's no text.
This is on OS4 and OS5.
I assume that this is a bug, but I desperately need a workaround. Has anyone see this before?
Tim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我现在已经解决了这个问题。这是一个奇怪的 iOS 错误,在以下情况下会引发:
父视图。
像素
I've now fixed this. It's a curious iOS bug that's provoked when:
parent view.
Tim