Determine if view that appears was pushed or came from back button in navigation bar

前端 未结 3 981
天命终不由人
天命终不由人 2021-02-20 05:55

Is there a way to tell if a new controller came from a navigation back button or was pushed onto the stack? Id like to reload data only for pushing on the navigation stack, not

3条回答
  •  无人及你
    2021-02-20 06:31

    If your push also includes instantiating the view controller, put your push-only logic in viewDidLoad. It will not be called on back because it has already been loaded.

提交回复
热议问题