如何使用`prepare(_ context:CGContext,with rendererContext:UIGraphicsRendererContext)`?
问题描述:
开始的iOS 10,苹果文档这类功能的UIKit:如何使用`prepare(_ context:CGContext,with rendererContext:UIGraphicsRendererContext)`?
class func prepare(_ context: CGContext, with rendererContext: UIGraphicsRendererContext)
不过,我是不是能够访问prepare
在Xcode 8.3.3:
// error: Type 'UIGraphicsRenderer' has no member 'prepare'
UIGraphicsRenderer.prepare(UIGraphicsGetCurrentContext()!, with: UIGraphicsRendererContext())
// error: Type 'UIGraphicsImageRenderer' has no member 'prepare'
UIGraphicsImageRenderer.prepare(UIGraphicsGetCurrentContext()!, with: UIGraphicsRendererContext())
答
功能准备的定义在UIGraphicsRendererSubclass
您可以通过调用import UIKit.UIGraphicsRendererSubclass
导入此类您必须导入导入UIKit.UIGraphicsRendererS ubclass'''',该方法在这个类中定义。 –
不客气,很高兴我可以帮助:) –