views:

495

answers:

1

I tried invoking UIGraphicsGetCurrentContext() in other places other than in drawRect. It give me a NULL. Is it true that I can can only get current context in UIView's drawRect: only?

+3  A: 

Yes, outside of drawRect, the default context is nil. Before drawRect is called, a view will push its context onto the stack, and pop it after drawRect ends.

Chris Lundie