官术网_书友最值得收藏!

Push and pop

We saw in the preceding example how to navigate to another view controller using segues. Additionally, we can do this programmatically by calling the following:

self.navigationController?.pushViewController(viewController, animated: true) 

This pushes a new view controller with or without animation.

Also, to pop view controllers, we have three functions that we can use:

  • The popViewControllerAnimated function: This will pop the top view controller and update the UI to the preceding one
  • The popToRootViewControllerAnimated function: This will pop all view controllers in the stack, but the root view controller
  • The popToViewController:animated function: This will pop all view controllers in the stack not upto the root but upto a given reference to the view controller to pop to it
主站蜘蛛池模板: 乳源| 桃园市| 潼关县| 桐柏县| 泗阳县| 鹤岗市| 土默特右旗| 于都县| 莒南县| 喜德县| 登封市| 天长市| 多伦县| 岱山县| 泰宁县| 丹东市| 白朗县| 东海县| 晋江市| 鄯善县| 玛沁县| 简阳市| 乐业县| 苏尼特左旗| 搜索| 门头沟区| 米林县| 广河县| 平塘县| 西城区| 宿松县| 甘洛县| 峨边| 马关县| 札达县| 军事| 平南县| 香格里拉县| 饶平县| 阿拉善右旗| 天门市|