UISplitViewController - set always visible master controller when - ios

I've studied examples of split view (like this one) and it works great. I just need one change of behavior. I would like to have both master and detail controller visible when user have iPad in portrait. It should work just like FB Messenger or Skype. Both controllers side-by-side and without able to hide master controller. How is it possible to do that? Thanks for help
Bonus question: Is it possible to somehow set behavior for iPad portrait be same like iPhone portrait? If I would change my mind and I would like to have detail in fullscreen and after tap on left navigation bar button I would have master view in fullscreen and without detail visible. Is i possible or split view decides that and there is not much what I can do about it?

A UISplitViewController has a property called preferredDisplayMode. You can set this to any one of these values:
UISplitViewControllerDisplayModeAutomatic
UISplitViewControllerDisplayModePrimaryHidden
UISplitViewControllerDisplayModePrimaryOverlay
UISplitViewControllerDisplayModeAllVisible
You are looking for UISplitViewControllerDisplayModeAllVisible.
[self.splitViewController setPreferredDisplayMode:UISplitViewControllerDisplayModeAllVisible];
UISplitViewControllerDisplayModeAllVisible
The primary and secondary view controllers are displayed side-by-side onscreen.
Available in iOS 8.0 and later.
You can read more about the display modes here on Apple's documentation.

Related

Youtube-like video control bar in the bottom

In the youtube app there's a possibility to collapse video into a small preview window with a playback and controls while you navigating in the different parts of the app. By tapping on the window you can always switch to full screen mode again.
I wonder: what't the best approach to implement similar functionality? For now I see few options but I'm not very well aware of the implications of these options.
Note: I have an iPhone tabbar based app.
Create a popover modal view controller, that is presented on top of current navigation stack in a current tab
Create a view and stick it to the bottom of the screen.
Create a view in bounds of a tabbar controller
Create a modal view controller embedded in tabbar controller.
Just from the list I suspect that using a specialized UIView (2) would be the worst possible way to do this. But I don't know about the rest. Any advice would be greatly appreciated.

Change detail transition animation UISplitViewController

I have a UISplitViewController. When run in compact mode the detail views are "pushed" onto the navigation stack like pages (with the back button in the navigation bar).
I would like to simply change the page transition animation from a push from the side, to a modal style animation: i.e., have the detail view slide in up from the bottom. But only have it animate as a modal when the UISplitViewController is in compact mode (running on smaller devices - i.e., iPhones, etc).
An image for context:
As you can see, this is a normal page transition, but I would like the detail to slide up like a "page sheet" transition if possible.
I've tried modifying the segue in Main.storyboard however that changes the transition even for regular sizes (i.e., iPads, etc) which makes an additional detail view slide over the side-by-side view that's seen on regular sized devices.
Any help is appreciated!
Although it is doable, I would highly recommend against it. If you still want to go ahead with it, the simplest way would be to create two identical viewControllers with two different segues and segue types. Then you can make a check on device idiom and call the relevant segue. Again, I would not recommend such an approach

UISplitViewController in UITabBarController - SplitView Navigation Bar Glitch / Bug or me doing something wrong?

QUESTIONS AT THE END OF THE POST
PROBLEM: I discovered a strange behavior of UISplitViewController when embedding it in a UITabBarController. The setup is quiet simple and can be reproduced without any coding. Create a StoryBoard based app and drag a UITabBarController onto the StoryBoard and make it the initial view controller. Then drag a UISplitViewController onto the board and make it an item of the UITabBarController. Embed the UISplitViewControllers detail view controller in a UINavigationController as well. Finally, set the background color of the master and detail view controllers to something noticeable.
The StoryBoard should look like this:
Step 1: Run the application on an device which can show master and detail at the same time (e. g. iPad or big screen iPhone). You should notice that the master is not extending under the bars and instead, the background of UISplitViewController shines through.
Step 2: Rotate the screen to portrait so the master gets collapsed. Swipe in from the side to reveal the master. At this point, both navigation bars are showing the correct background color.
Step 3: Rotate the screen back to landscape. Now the detail has the background of the UISplitViewController and the master is showing the correct color.
FINDINGS:
On start, the tableview of the master is not extending under the navigation bar.
When and only if revealing the master in portrait mode and then rotating back, the glich changes so that now the master extends under the bars and the detail does not anymore.
If not revealing the master in portrait, you can rotate as many times as you want without changing the behavior
It only happens on devices which can show master and detail at the same time
It only happens when embedding a UISplitViewController in a UITabBarController
QUESTIONS:
Why are master and detail not expanding correctly under their navigation bar?
Why does this only happen on iPad/iPhone Plus and not on regular iPhones (there everything works exactly as expected)?
Is there any fix I could apply to make this work on iPad?
Is there a better design approach than having a TabBar with a master-detail flow embedded? For me a TabBar just seems right to switch between different types of content in my app and I don't want to have a full width tableview on iPads. The SplitViewController also seems to be the right approach to display my content...
5 Month later there is still no solution for this. Moreover, as I was stumbling across this issue once again while developing another app, I found this old post from 2015 having the same issue: Navigation bar for split view controller is darker when inside a tab bar controller
So I guess Apple has no intention on fixing their own controllers and we developers are screwed. The only way we can have a UITabBar at the bottom while showing a UISplitViewController above with proper translucent UINavigationBars is to implement our own container view controllers.
I finally solved the issue by using a plain UIViewController with a UITabBar pinned to the bottom while using the UIViewController containment API to show/hide my UISplitViewControllers.

UISplitViewController - hiding master view in iPad landscape

I'm using the iOS SDK 8.1.
In landscape mode, is it possible to make the master view animate left to hide and then animate right to display again? I don't want it to overlap the detail view like in portrait mode.
Would I have to create my own custom split view controller for that functionality?
No, it is not possible to hide/unhide master in landscape mode.
There are many opensource libraries for creating custom splitView controller available.
This is one good library : https://github.com/mutualmobile/MMDrawerController

iOS UISplitViewController - hide master view pane with smooth transition

I'm working on an iPad app with the UISplitViewController. I've managed to add a button on the detail view navigation bar to 'maximise' the detail pane in landscape mode by hiding the master view (like Dropbox does). I did this by setting the split view controller delegate to nil and then back to it's delegate in order to force 'shouldHideViewController' to fire. This works but there's no transition - it just flicks to full screen. I'd like the view to stretch across the screen in a transition (as Dropbox does).
Can anybody suggest a way to achieve this?

Resources