如何使用`prepare(_ context: CGContext, with rendererContext: UIGraphicsRendererContext)`?
How to use `prepare(_ context: CGContext, with rendererContext: UIGraphicsRendererContext)`?
从 iOS10 开始,Apple 在 UIKit 中记录了这个 class 函数:
class func prepare(_ context: CGContext,
with rendererContext: UIGraphicsRendererContext)
但是,我无法在 Xcode 8.3.3 中访问 prepare
:
// error: Type 'UIGraphicsRenderer' has no member 'prepare'
UIGraphicsRenderer.prepare(UIGraphicsGetCurrentContext()!, with: UIGraphicsRendererContext())
// error: Type 'UIGraphicsImageRenderer' has no member 'prepare'
UIGraphicsImageRenderer.prepare(UIGraphicsGetCurrentContext()!, with: UIGraphicsRendererContext())
函数 prepare 在 UIGraphicsRendererSubclass
中定义
您可以通过调用 import UIKit.UIGraphicsRendererSubclass
导入此 class
从 iOS10 开始,Apple 在 UIKit 中记录了这个 class 函数:
class func prepare(_ context: CGContext,
with rendererContext: UIGraphicsRendererContext)
但是,我无法在 Xcode 8.3.3 中访问 prepare
:
// error: Type 'UIGraphicsRenderer' has no member 'prepare'
UIGraphicsRenderer.prepare(UIGraphicsGetCurrentContext()!, with: UIGraphicsRendererContext())
// error: Type 'UIGraphicsImageRenderer' has no member 'prepare'
UIGraphicsImageRenderer.prepare(UIGraphicsGetCurrentContext()!, with: UIGraphicsRendererContext())
函数 prepare 在 UIGraphicsRendererSubclass
中定义
您可以通过调用 import UIKit.UIGraphicsRendererSubclass