【发布时间】:2017-05-12 18:33:24
【问题描述】:
我一直在使用这个函数通过 CG rect 将两个图像组合在一起:
let renderer = UIGraphicsImageRenderer(size: CGSize(width: frame.bounds.size.width, height: frame.bounds.size.height))
img = renderer.image { ctx in
let someSize = CGSize(width: imageView.bounds.size.width, height: imageView.bounds.size.height)
currentImage.scaleImageToSize(newSize: someSize).draw(in: CGRect(x: 0, y: 35, width: frame.bounds.size.width, height: imageView.bounds.size.height))
//textView?.draw(CGRect(x: 0, y: 0, width: textView.bounds.size.width, height: textView.bounds.size.height))
frames = UIImage(named: framesAr)
frames?.draw(in: CGRect(x: 0, y: 0, width: frame.bounds.size.width, height: frame.bounds.size.height))
}
我使用这个 CGRect 函数将 currentImage (UIImage) 和 frame(UIImage) 组合成一个 UIImage 没问题,但是我尝试以相同的方式添加文本视图似乎不起作用。
我在图像前面有一个 UITextView 用于测试目的。我希望能够在 textView 中输入文本并使用上述函数中的注释行来绘制整个 textView 及其内容。
当图像被保存时,函数运行,但 textView 被简单地忽略。谷歌搜索会产生关于如何向图像添加字符串的结果,但不会以这种方式产生用户可填充的文本视图。
任何帮助将不胜感激!