iOS development in the interface jump in two ways, up and down jump and left and right jump.
Next Jump _to:
Let Secondviewcontroller = Secondviewcontroller () Self.presentviewcontroller (Secondviewcontroller, animated: True, Completion:nil)
on jump _back:
Dismissviewcontrolleranimated (True, Completion:nil)
right Jump _to:
(Push the new view controller into Navigationcontroller, which is equivalent to the stack operation)
Let Secondviewcontroller = Secondviewcontroller ()
left jump _back:
(The current view controller is removed from the Navigation view controller stack to return to the upper-level interface)
( - ) Back_ to the previous level:
Let Firstviewcontroller = Firstviewcontroller () Self.navigationcontroller?. Popviewcontrolleranimated (True)
(-) Back_ specified interface:
Get a view controller in the View controller let Viewcontroller = Self.navigationcontroller?. Viewcontrollers[0] Self.navigationcontroller? Poptoviewcontroller (Viewcontroller as! Uiviewcontroller, Animated:true)
(-) back_ root view:
The settings for the root view need to be set in Appdelegate:
var window:uiwindow? Func application (application:uiapplication, didfinishlaunchingwithoptions launchoptions: [Nsobject:anyobject]?)- > Bool { var firstviewcontroller = Firstviewcontroller () var rootnavigationviewcontroller = Uinavigationcontroller (Rootviewcontroller:firstviewcontroller) self.window!. Rootviewcontroller = Rootnavigationviewcontroller return True }
Swift enables the iOS interface to jump