开发者

How to get the graphics context of an UIView?

For example, I want to draw something directly to an UIView. I need an CGContextRef, but I don't want to make a new one since that would eat up too much memory. Can I obtain the CGContextR开发者_如何学运维ef from an UIView?


Only in the drawRect method:

UIGraphicsGetCurrentContext()


Outside of the redraw call, I do not believe so. I remember trying this myself a while ago. Sorry I can't be more specific, but I've not touched the iPhone SDK in months.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜