开发者

Refreshing ViewController after popViewControllerAnimated

I have a root ViewController (RootViewController) that calls pushViewController to display another ViewController (DetailViewController). In DetailViewController 开发者_StackOverflow中文版I make edits that affect the contents displayed in the root ViewController. So I need to redraw the view in RootViewController after the DetailViewController is removed via popViewControllerAnimated.

The problem is that setNeedsDisplay does not seem to work in this scenario. In the viewWillAppear method of RootViewController, I call:

[self.view setNeedsDisplay]

However, the contents of the RootViewController view does not update. So I am wondering if there is something about Navigation Controllers that prevents setNeedsDisplay from working.

The only workaround I could find is that the following code, which forces a call to viewDidLoad, which redraws the entire view

self.view = nil;


You can update your view in viewWillAppear instead of viewDidLoad. You don't need to call setNeedsDisplay.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜