2017-08-08 80 views
-1

开始的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()) 
+1

导入此类您必须导入导入UIKit.UIGraphicsRendererS ubclass'''',该方法在这个类中定义。 –

+0

不客气,很高兴我可以帮助:) –

回答

1

功能准备的定义在UIGraphicsRendererSubclass 您可以通过调用import UIKit.UIGraphicsRendererSubclass