开发者

How to get the graphics context of an UIView?

开发者 https://www.devze.com 2022-12-25 15:42 出处:网络
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开发者_如何

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

精彩评论

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

关注公众号