Does setNeedsDisplay have immediate effect or it is merely queued for later?
Does anybody here know whether setNeedsDisplay
results in an immediate drawRect
call and immediate updatin开发者_运维知识库g of the screen?
Or is it merely a queued request?
Thanks.
The view is not actually redrawn until the next drawing cycle. This simply notifies the system that the view should be redrawn.
See UIView Class Reference
You can apparently accomplish this by setting the content mode to UIViewContentModeRedraw
. I haven't done this personally, but the code should be something along the lines of
UIView *redrawView = [[UIView alloc] initWithFrame:frame];
...
redrawView.contentMode = UIViewContentModeRedraw;
See View and Window Modes: Content Modes
精彩评论