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.