How to get the graphical context of a UIView?

For example, I want to do something right in a UIView. I need a CGContextRef, but I do not want to create a new one, since this will be too much memory. Can I get a CGContextRef from a UIView?

+3
source share
2 answers

Outside of the call to redraw, I don't believe. I remember how I tried it before. Sorry, I could not be more specific, but I did not touch the iPhone SDK for several months.

0
source

Only in the drawRect method:

UIGraphicsGetCurrentContext()

+4
source

Source: https://habr.com/ru/post/1739112/


All Articles