How to add UIToolbar to both UISplitViewController views?

And then does it merge vertically? Here is an example from the IMDB application.

http://img855.imageshack.us/img855/9669/imdb1.jpg http://img39.imageshack.us/img39/5636/imdb2.jpg http://img39.imageshack.us/img39/5636/imdb2.jpg

They did it perfectly, and I would like to know how I can reproduce it. Right now, I can’t add it to the left side of the split controller. Thanks in advance.

+4
source share
1 answer

The short answer is, you do not.

You have two UIToolbar and some code that moves the contents of one to the other when the UISplitViewController calls its delegate

 – splitViewController:willHideViewController:withBarButtonItem:forPopoverController: 

which moves items back to

 – splitViewController:willShowViewController:invalidatingBarButtonItem: 

method.

For example, this might work:

 – splitViewController:willHideViewController:withBarButtonItem:forPopoverController: { // … NSArray *leftItems = leftBar.items; rightBar.items = [leftItems arrayByAddingObjectsFromArray:rightBar.items]; leftBar.hidden=YES; // … } – splitViewController:willShowViewController:invalidatingBarButtonItem: { // … NSArray *rightItems = rightBar.items; NSUInteger lc = [leftBar.items count]; rightBar.items = [rightItems subArrayWithRange:NSMakeRange(lc,[rightItems count] - lc)]; leftBar.hidden=NO; // … } 
+1
source

Source: https://habr.com/ru/post/1342069/


All Articles