2017-08-08 38 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