开发者

Refresh UIView for drawRect?

Is there a way to refresh a UIView which will subsequently cal开发者_Python百科l drawRect?

EDIT:

I am doing [view setNeedsDisplay] however it doesn't appear to be working! Or at least my NSLog in drawRect isn't displaying.

EDIT2:

Please see comments of selected answer for the gory details! Number one tip: Make sure it's property linked!


Yes! Just call

[self.view setNeedsDisplay];

from your view controller, or [self setNeedsDisplay] directly from UIView, if you're using a subclass.

EDIT: make sure you're calling this on the correct view. The code above will call the view property of the view controller you're calling it from; this isn't necessarily correct, though it depends on your needs.

Also, make sure that the outlet is connected in Interface Builder, if you're creating this view in a nib file.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜