Swift enables the iOS interface to jump

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.