Several segue differences in storyboard and view switching: Push,modal,popover,replace and Custom

Source: Internet
Author: User

First, view switch type introduction in storyboard, there are several different types of segue, and the types of segue are different in the development of the iphone and ipad. In the iphone, Segue has: Push,modal, and custom three different types, these types of differences in the way that appear with new pages. In the ipad, there are five different types of push,modal,popover,replace and custom. Modal modal conversion  The most commonly used scene, the new scene completely covers the old one. Users can no longer interact with the previous scene unless they close the scene first.
is the standard toggle in Viewcontroller, including fading out what, you can choose to toggle the animation. Modalview: It will pop up a view, you can only operate on the view, and cannot switch to other view, unless you close the Modalview. The Modal view corresponds to the segue type that is Modal segue. *modal:transition to another scenes for the purposes of completing a task. When user is done in the pop-up Modalview, the dismiss view should be Modal Scene and then switch back to the Originalview. Push
The push type generally requires the first interface to be a navigation controller.
Is the kind of navigation that is used at the lower level of the View controller *push:create a chain of scenes where the user can move forward or back. The Segu E type is used in conjunction with navigation Viewcontrollers. PopOver (IPad only)  PopOver type, is to use the form of floating window to display the new page *popover (IPad only):D isplays the scene in a pop-up "window" over top of the current view. *replace (IPad only):  Replace the current scene,replace the present scene with another. This was used in some specialized iPad viewcontrollers (e.g. Split-view Controller). Custom
is the custom jump mode. *custom:used for programming a customtransition between scenes. Using custom storyboard types in Segue http://ryan.easymorse.com/?p=72 References:Using storyboard: Passing Data with segue
Http://www.cnblogs.com/mybkn/archive/2012/03/22/2411842.html WWDC2011 Video Introduction to storyboarding abstract
Http://blog.sina.com.cn/s/blog_834f346f0100s4jr.htmlstoryboard encountered a segue problem.
Http://www.cocoachina.com/bbs/simple/?t92552.htmliOS:storyboard (2)
http://blog.csdn.net/totogogo/article/details/7361191 Second, storyboard view switch

First, brief

Storyboard is a new way that you can use to define the user interface, like Xib.

Unlike Xib, it can manage multiple viewcontroller at the same time, and you can configure a jump relationship between Viewcontroller in storyboard.

Second, the use of storyboard

If you are creating a new project, Xcode templates can provide a configured storyboard for you to use. For other applications, the process of using storyboard is as follows:

1. Configuring the Application Info.plist file

    • Add Uimainstoryboardfile, with a value of storyboard file name.
    • Delete the original nsmainnibfile

2. Create a storyboard file just like the previous Xib file

3, configuration storyboard in the Viewcontroller

Third, the creation of storyboard

You can use Interfacebuilder to create a stroyboard for your application, which is generally enough for an app to use a storyboard, but if you want to create more than one, you can, if you like. A stroyboard should contain at least one viewcontroller.

In the iphone, for every viewcontroller in storyboard, a scene is managed, and each scene manages the stuff on screen, but for the ipad, multiple scenes can be present on a screen at the same time. You can drag and drop Viewcontroller from the library to your storyboard.

When you want to associate two Viewcontroller, you can press the control key, with the mouse from a viewcontroller in the button,table view cell ... Drag and drop connect to another viewcontroller you want to jump to, so create a segue, don't forget to set identifier OH.

Iv. data transfer between scene

When you trigger a segue from the current scene, the system automatically calls Prepareforsegue:sender: This method. If you want to transfer data from one interface to another, you should override this method.

A---"B

Want to transfer data NSString A_data from Acontroller to Bcontroller, then in Bcontroller

@property a NSString data

Then add the method in the Acontroller

-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) sender

{

NSLog (@ "The Segue ID is%@", segue.identifier);

Uiviewcontroller *destination = Segue.destinationviewcontroller;

if ([Destination respondstoselector: @selector (setData:)])

{

[Destination setvalue:@ "This is the data to be transmitted" forkey:@ "" "];

}

}

After that, the Data property in the Bcontroller is received.

V. Jumps between the Viewcontroller

1, if the current Viewcontroller in the storyboard and to jump between the viewcontroller between the segue exist, you can execute Performseguewithidentifier:sender: This method to achieve jump.

2, if the target Viewcontroller exists in storyboard, but there is no segue. You can go through Uistoryboard's Instantiateviewcontrollerwithidentifier: This method gets to it, and then uses the way you want to implement the jump, such as: press stack.

3, if the target viewcontroller does not exist, then go to create it.

http://blog.csdn.net/piziliweiguang/article/details/8080426

Storyboard Several segue differences and view transitions: push,modal,popover,replace and custom

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.