reload UIViewController
I have a certain code that is executed on the viewDidLoad() of a UIViewController I have. The problem is that it is only loaded for the first time only. After it is loaded the first time and I switch to some other view and come back to this view, it doesn't call the viewDidLoad again. So where should I put this code at so tha开发者_开发知识库t everytime this view is displayed it executes this code?
i guess in viewWillAppear
good luck
You should put it in - (void)viewDidAppear:(BOOL)animated
. This gets called every time your view comes on screen.
Please refer to life cycle of iphone application
- (void)viewDidLoad
should only be called once.
so you should use,since this method is called each & every time the View is called
- (void)viewWillAppear:(BOOL)animated
精彩评论