views:

402

answers:

1

Hi!

I'm taking CS193P iPhone Development courses, and even if.. I know that I'm pretty late comparing to Stanford's students, I'm doing Assignment 3.

My current problem is: My drawRect method does not get called on every setNeedsDisplay... but only on the first.

Also, what I noted is that my polygon object is NULL (from PolygonView).

Here are the sources of my project:

PolygonShape.h http://pastie.org/855503

PolygonShape.m http://pastie.org/855507

Controller.h http://pastie.org/855508

Controller.m http://pastie.org/855509

PolygonView.h http://pastie.org/855511

PolygonView.m http://pastie.org/855513

If someone could help me.. I guess this is pretty simple but I can't seem to find it!

Thanks a LOT! :)

+1  A: 

drawRect: is not necessarily called on every setNeedsDisplay.

Calling setNeedsDisplay only clear the cache of the view's layer. drawRect: will be called only when the screen is actually refreshed. So before the runloop resumes calling setNeedsDisplay multiple times may not have any effects.

KennyTM