how to not call viewdidload in uinavigationcontroller?

后端 未结 3 1461
庸人自扰
庸人自扰 2021-01-29 12:21

I am looking for a solution to my situation. My app is as followed:

On VC1 there is a textfield and button. User types a name. Then click on a button. This button open V

3条回答
  •  情书的邮戳
    2021-01-29 13:20

    viewDidLoad method is called only once per lifecycle of UIViewController, so most probably you are creating somehow new VC1. You need keep reference to first VC1 and go back to that view controller.

    To navigate using UINavigationController use those methods:

    [self.navigationController pushViewController:VC2];
    
    [self.navigationController popViewControllerAnimated:YES];
    

    (call them inside VC1 / VC2)

提交回复
热议问题