[Ios] The splitViewController under the ipad makes your APP look cool !, Ipadsplitview
You can use splitViewController on ipad
The splitViewController contains two viewcontrollers.
This is a way to split the screen into two parts.
In the horizontal state, two or both regions are displayed.
We usually call it
Master on the left
Detail on the right
How can we interact between the master and detail?
When you want to transmit information, as long as the current ViewController is under the splitViewController
You can use
Self. splitViewController. viewControllers to obtain the ViewController Array under the splitViewController.
This array uses nonatomic copy. Each time you change the controller, You need to assign a new value to the controller. [You can ignore this sentence and it is rarely used.]
This array has only two objects.
The master is located at location 0.
At location 1 is detail.
Therefore, lastObject is usually used.
And firstObject to obtain the master and detail of the current splitViewController
Get the corresponding master, and detail you can transmit data as you like ~~~.
========================
How to open a hidden master by clicking the toolbar button on the portrait Screen
First, let your strong or persistent master vc implement <splitViewControllerDeletage>
Then rewrite several methods
1 is whether to hide.
One is when hidden XXX
One is SHOW XX
This is because a toolBarItem object will be returned during hiding and show. This object is used to control the display of the master.
Upload this object to detail and set it to the toolbar of detail.
Note: The detail toolbar in splitVc is hidden in the horizontal state [premise: first-level subclass of the Current VC view]
The delegate method is usually used to pass this toolBarItem. Let detail implement a protocol and then. Get the detail object through splitvc.
The toolBarItem is uploaded to detail and added to the detail toolbar.