Summary of Segue usage in storyboard

Source: Internet
Author: User

Introduction
Scene transitions are very common in applications, allowing the user to operate within one view controller, to instantiate and display another view controller, and to create a segue (transition) that is connected between the two. For example, in a navigation controller, a scene action can trigger a transition to load and display another scene, the transition can automatically push the next controller into the navigation stack.

Description

Xcode6 before storyboard several segue differences and view switches: Push, modal, popover, replace, and custom refer to: http://www.2cto.com/kf/201210 /161737.html
Xcode6 Segue cancel the original push and modal (deprecated), you can view the Official document description:https://developer.apple.com/library/ios/recipes /xcode_help-ib_storyboard/chapters/storyboardsegue.html
New methods Show and present modally are generally available to meet our needs

Show

Displays content in the master area or detail area based on the contents of the current screen.

For example: If the app currently displays both master and detail views, the content will be pressed into the detail area.

If the app currently displays only the master or detail view, the content is pressed into the top-level view in the current view controller stack.


Show Detail

Present content in the detail area.

For example: Even if the app displays both master and detail views, the content will be pressed into the detail area

If the app currently displays only the master or detail view, the content replaces the top-level view in the current view controller stack.


Present modally

Use modal display content. The presentation style (Uimodalpresentationstyle) and Transition style (Uimodaltransitionstyle) options are available in the Properties panel


Present as Popover

Use pop-up boxes to present content at anchor points in an existing view. This option specifies the available orientation of the arrows that appear on the side of the PopOver view, as well as an option to specify the anchor point view.

(Translation from netizens)


Storyboard Create Segue
   
hold down the right mouse button, drag the mouse pointer from a unit swatch to the new scene, and hover over the scene to see the highlight, indicating that you can connect. Release the right mouse button and select the Show option to pop up the selection segue location in the floating menu. Creating segue means that as long as the user taps the cell Swatch, the view controller connected to the other end allocates the memory space and prepares to switch.

Dynamic execution Segue

      In the storyboard established in the segue, is the direct jump, inconvenient to add additional conditions to judge, if you want to do the landing and other functions, you must dynamically perform Segue operation
    
First build the segue in storyboard, not from the button and other controls, but from the Viewcontroller establishment, must specify the identifier, after the establishment, jump execution     

     [self performseguewithidentifier:@ " Seguexxx "sender:self";    

Use identifier to specify the segue to perform

Passing Data with Segue
For example, to transfer data NSString *adata from Acontroller to Bcontroller, create a Bcontroller nsstring property in RecvData, and then add a method in Acontroller

  1. - (void) Prepareforsegue:(uistoryboardsegue *) Segue Sender:(id) sender {
  2. Uiviewcontroller *destination = Segue. Destinationviewcontroller;
  3. if ([Destination respondstoselector:@selector(SetData:)]) {
  4. [Destination setValue: AData forkey:@"recvdata"];
  5. }

  6. }

In the Bcontroller Viewdidload method, you can view the _recvdata value directly.

Summary of Segue usage in storyboard

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.