Push/modal/popover/replace/custom Summary of the view in iOS development

Source: Internet
Author: User

In storyboard, segue has several different types. In iphone and ipad development, segue has different types.
In the iphone, segue has three different types: push, modal, and custom. The difference between these types lies in the way new pages appear.
In ipad, there are five different types: push, modal, popover, replace, and custom.

Modal mode conversion
The most common scenario is that the new scenario completely covers the old one. Users cannot interact with the previous scenario unless they disable it first.
It is the standard switching mode in viewController, including fading out or something. You can choose to switch the animation.
Modalview: a view is displayed. You can only operate on the view, but cannot switch to another view, unless you disable modalview.
The segue type corresponding to the Modal View is the modal segue.

The Push type usually requires the first interface to be a Navigation Controller.
It is the method used to draw from the right when the lower level of the navigation View Controller

The popover type displays new pages in the form of floating windows.

Replace type is replace

Custom is the custom jump method.


Data transmission between views
When you trigger a segue from the current scenario, the system will automatically call the prepareForSegue: sender: method. If you want to transfer data when switching from one interface to another, you should override this method.
A-> B
To transmit NSString A_data from AController to BController
@ Property: An NSString data
Then add the method to 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 passed" forKey: @ "data"];
    }  
}
Then, the data attribute in Bcontroller receives the data.

Jump between viewcontrollers
1. If the current ViewController and the ViewController to be redirected exist in the Storyboard, you can execute javasmseguewithidentifier: sender: to achieve redirection.
2. If the target ViewController exists in the Storyboard, but there is no segue. You can use the instantiateViewControllerWithIdentifier method of the UIStoryboard to get it, and then use the method you want to achieve the jump, such as: stack pressure.
3. If the target ViewController does not exist, create it.

Related Article

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.