Swift 3 and CGContextDrawImage

后端 未结 2 486
终归单人心
终归单人心 2020-12-15 18:18

I want to translate this line to the Swift 3 current syntax code but seems there are some problems:

CGContextDrawImage(context, CGRect(x:0.0,y: 0.0,width: im         


        
2条回答
  •  猫巷女王i
    2020-12-15 18:54

    You need to call it as if it's an instance method of CGContext:

    context.draw(image!.cgImage!, in: CGRect(x: 0.0,y: 0.0,width: image!.size.width,height: image!.size.height))
    

    Check the latest reference of CGContext.

提交回复
热议问题