View Full Version : custom drawing in view

Nov 12, 2008, 09:54 AM
Hi All,

I am doing a custom drawing in view's drawrect method. I need to update that from outside the view. How would I programmatically force a draw operation on the view ?


Nov 12, 2008, 10:08 AM
Surely just:

[YourClassName.yourView drawRect:newRect];

... and make sure you've imported the header of YourClassName into the calling class so that it can see the yourView object.

Nov 12, 2008, 10:25 AM
I think the recommended method is to pass a message to the view telling it what to add to its list of what to update during the next screen refresh (drawRect). Then call the view's setNeedsDisplay so that a screen refresh for the view gets scheduled.