Accessing a Top Navigation Controller from a Subview Navigation Controller

前端 未结 3 1763
再見小時候
再見小時候 2021-02-04 07:26

I have a my views and controllers set up like so.

  1. A Tab/Bar controller
  2. Within 1. is a root view controller
  3. within 2. is a programmatically create
3条回答
  •  无人及你
    2021-02-04 07:53

    Have a look at UIViewController's navigationController and tabBarController properties. These will return the corresponding navigationController or tabBarController that the given UIViewController 'belongs' to.

    So you can do something like:

    [customController.navigationController pushViewController:newController animated:YES];
    // Similarly for tabBarController ...
    

提交回复
热议问题