开发者

Refresh UIView for drawRect?

开发者 https://www.devze.com 2023-01-29 04:24 出处:网络
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 d

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

精彩评论

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