I want to redraw a view. When I touch a button, my view have to redraw itself. (have to call viewWillAppear)
But view's setNeedDisplay method doesn't redraw itself immediately. Because I have to redraw it immediately, the method is not suitable to me.
I tried to remove all of viewController's view's subviews and to change viewController's view to other view. But these didn't work. (don't redraw)
I need your help acutely.
Thank you for your reading.
I think there are some misunderstandings here. Let's set things straight:
viewWillAppear:
has nothing to do with the drawing of the view.setNeedsDisplay
doesn't redraw the view instantly, but we're talking milliseconds. So that's not even relevant.Since you want viewWillAppear:
to be called I'm assuming that what you call redrawing the view really should be referred to as relayouting the view. I assume that what you do in viewWillAppear:
is setting the frames of you're views and possibly add/remove and/or show/hide some views.
I suggest that you move that code out of viewWillAppear:
and into it's own method that will be called from viewWillAppear:
and when you tap the button.
Since you don't provide your viewWillAppear:
code this is all based on assumptions, so if my assumptions are wrong, please let me know and please do provide your "redraw" code.