简体   繁体   中英

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 that everytime this view is displayed it executes this code?

我想在viewWillAppear祝你好运

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM