Title says it all.
标题说明了一切。
I'm trying to figure out what the UIGraphicsGetCurrentContext()
equivalent is for OS X.
我试图弄清楚UIGraphicsGetCurrentContext()等效于OS X的内容。
2 个解决方案
#1
12
[NSGraphicsContext currentContext].CGContext
.
[NSGraphicsContext currentContext] .CGContext。
(The -CGContext
property is available in 10.10 and later; in earlier versions, you can use graphicsPort
.)
(-CGContext属性在10.10及更高版本中可用;在早期版本中,您可以使用graphicsPort。)
#2
3
For Swift: NSGraphicsContext.currentContext()?.CGContext
对于Swift:NSGraphicsContext.currentContext()?. CGContext
#1
12
[NSGraphicsContext currentContext].CGContext
.
[NSGraphicsContext currentContext] .CGContext。
(The -CGContext
property is available in 10.10 and later; in earlier versions, you can use graphicsPort
.)
(-CGContext属性在10.10及更高版本中可用;在早期版本中,您可以使用graphicsPort。)
#2
3
For Swift: NSGraphicsContext.currentContext()?.CGContext
对于Swift:NSGraphicsContext.currentContext()?. CGContext