UISplitViewController (Swift): Show / hide master view controller on iPhone programmatically - ios

I am currently trying to port our existing app to Swift. I used a lot of 3rd party libraries in the "old" app, but I want to avoid that in the new implementation, because it gave me some heavy compatibility issues with newer iOS versions.
So here is my situation: I previously used a MMDrawerController (https://github.com/mutualmobile/MMDrawerController) to create a main menu, that can be swiped in from the left at any time (regardless which ViewController is shown in center as main view). Now I am trying to achieve the same functionality with UISplitViewController in my Swift app.
Everything works fine on the iPad.
* Landscape: MasterViewController (main menu) is visible all the time. That's ok because we have enough space
* Portrait: MasterViewController can be swiped in from the left (or can be toggled via displayModeItem())
But I am facing issues on iPhone and I am not sure if I could solve them anyhow. Is there a way to show the MasterViewController (via UIBarButtonItem) from ANY ViewController that is in the detail navigation stack? I know it's impossible to show it as an overlay like on iPad, but I need a functionality to toggle the current DetailViewController with the MasterViewController (and vice versa).
Any ideas are appreciated...
Thanks

Related

iOS UINavigationController loading to white screen but app is running

I'm developing an app with a single ViewController. When I run the app, it goes to that default LaunchScreen that is included when you start the file, and then proceeds to the ViewController. Everything is fine, it loads and does everything it's supposed to, which includes some audio feedback.
From my storyboard then, I've clicked on the existing ViewController and then Editor -> Embed In -> Navigation Controller. Navigation Controller appears, the Storyboard reflects the Navigation Bar on both screens, and the Navigation Controller has "Is Initial View Controller" checked. Great.
Now, however, if I run the app, the LaunchScreen goes and then a blank white screen follows. No navigation bar, none of the original interface. However, I still get my audio feedback - the app is running just fine.
So what's going on?
Let me know if there's anything you'd like to see (code, screenshots, etc.).
I was using PixateFreestyle to style some elements. At some point it seems I had rather heavy-handidly added:
view {
background-color:#ffffff;
}
Which covered the views nested in the root view controller. Figured it out when I noticed copying my classes to another project resulted in the same issues and started commenting out chunks. Took out the Pixate initialization and regained my view.
Thanks to everyone who offered help. If nothing else, I learned more about debugging iOS apps.

UISplitView equivalent on the iPhone.

I have an iPad app which I am attempting to make universal and port over to my iPhone following this tutorial. http://www.appcoda.com/ios-univeral-app-tutorial/ (feel free to post a link if you believe it will help me).
So far, I have added a new storyboard file, named it Main_iPhone.storyboard and configured my target etc. However my iPad app is a UISplitView controller, with options on the side (in the master view) which control my detailview.
What I want to know is the iPhone equivalent of this object as i was made aware it cannot be used on the iPhone. Guidance needed on this one.
Thanks.
This is a very generalized answer since I have no idea what your app does.
The rootviewController of the app should be a navigation controller. The the root controller of the navigation controller should be the view controller that is on the left side of the split view controller. I'm going to assume that is a tableviewController.
When the user selects a row in the tableview controller, push the view controller that was on the right side of the split controller.
Now you have a master-child relationship.
Another thing to consider is that with the upcoming iOS 8 release, you'll be able to easily implement iPad like master-detail views on iPhone. (the concept is size constraint classes). As a developer, you can download the new xcode beta (and osx yosemite beta) to test this out.

UISplitViewController like mail app

I want to make my application similar to mail.app in vertical orientation. It should show a master view controller by button, but not in pop over and in horizontal orientation it should look like a simple UiSplitViewController.
Have you any ideas? Is there any usable open source projects which could be re-used?
Mail.app is using a standard UISplitViewController. The behaviour was changed in iOS 5 so that it no longer uses a popover, but instead slides in the master view controller from the left. Although technically I guess you can still call that a "popover".
This may be confusing because the documentation and delegate methods still refer to a popover controller, but if you create a blank split view project from Xcode and run it on an iOS 5 device or simulator, you will get the new behaviour.
Try MGSplitViewController - very useful alternative to the UISplitViewController, has some nice configuration options.

How to make the landscape view look same as the portraitView while using a splitViewController?

What I meant is, When we use a UISplitViewController project
In portrait mode, whole window will be covered by the view and a popoverController will be presented to navigate to other views. In landscape mode, 40% of the window will be covered by a tableView using which we can change the view/page. And navigation button as well as popoverController will be hidden.
What I want is,
Even in landscape mode, it should be like portrait mode. No tablewView should be there. Whole window should be covered with the view in landscape mode. For navigating to other pages, a navigation button as well as the popoverController should be there.
How can I do this?? Plz help me...
Login to your developer account, goto dev forums and search for "UISplitViewController settings.app". there's lots of talk about that there. The summary is you can't do it though that controller apparently has some private features which make it possible (file a bug report telling apple they should expose that capability). There is a long discussion about building a splitview controller from scratch that mostly works this way. Alternately, rethink your design.

Mutltiple UISplitviewControllers in TabBar are not all notified of rotations events

I have an application with a tabBar containing 3 UISplitiViewControllers. Everything works well except for one scenario:
I have the ipad in landscape position on tab1. I click on tab3, then I rotate the ipad portrait mode. I click on tab1, it is well displayed in portrait mode, I'm happy.
I now come back to landscape position.
I click again on tab3 and there, the splitView controller is still displayed in "portrait mode". the delegate of my splitviewController in tab3 was never called.
Is there a way to force the rotation of this splitViewController in the "viewWillAppear"?
Your might find this git useful.
It is just a simple subclass of UISplitViewController that is notified of rotation changes.
Alternatively, this is a more robust replacement that adds lots of features.
Hope it helps.
BTW I have gotten apps approved using these classes.
After a deep analysis of event bubbling, it appears that rotation events are not forwarded to hidden splitViews...
There is no way to forward these events without using hidden apis.
Lots a developers have the same problem and this implementation of event management in splitView has been reported as a bug to apple, even though guidelines are to use only one splitView added to the root view of application.

Resources