开发者

CS193P - Assignment 3 - drawRect get called only on the first setNeedsDisplay

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 开发者_JS百科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! :)


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜