【发布时间】:2015-09-17 12:39:09
【问题描述】:
我有一个 uiview B,它是另一个 uiview A 的放大部分(“touchPoint”周围的区域被放大)。 当“touchPoint”发生变化时,我希望 B 更新其显示。我在 B 中有以下函数并且它确实更新了(当我调用 B.setNeedsDisplay() 时),但它使旧内容以某种方式可见,就像褪色的背景图像一样。 你们知道为什么旧的内容仍然出现,为什么会出现这种褪色的效果吗? 是因为我放大的区域有透明背景吗? 如何解决?
override func drawRect(rect: CGRect)
{
let context: CGContextRef = UIGraphicsGetCurrentContext()
CGContextTranslateCTM(context,1*(self.frame.size.width*0.5),1*(self.frame.size.height*0.5))
CGContextScaleCTM(context, 1.5, 1.5)
CGContextTranslateCTM(context,-1*(touchPoint.x),-1*(touchPoint.y))
viewToMagnify.layer.renderInContext(context)
}
我本来想发布一张图片,但我还没有足够的 * 积分... :-)
感谢您的指点!
【问题讨论】:
标签: ios uiview drawrect setneedsdisplay cgcontextref