I am trying to create a simple split view, Master/Detail, application on iOS8. The storyboard is something like the following:
SVC=SplitViewController
TBVC=TabBarViewController
TVC=TableViewController
SVC---(Master)→ TBVC → TVC -> ASplitViewMaster
|
+---(Detail) → ADetailViewRelatedToTheCurrentMasterView
Bascially, the user touches the “Items” tab, and a tableviewcontroller will appear that shows the kinds of items (i.e. Customers, Foods,etc.). The user touches “Customers”, I want to load a master that shows customers and shows the selected customer’s details in the Detail view. If the user touches a different item (i.e. Foods), then a different MasterView and its related details is loaded.
The project that I’ve created is about 95% towards a working model. It works properly on the iPhone. It works properly on the iPad in landscape mode, but the splitview’s displayModeButtonItem only shows a < without a title on the iPad in Portrait mode. I cannot figure out what I am doing wrong, so I hope that you can help me. I am sure that others may find this view architecture interesting, too, so hopefully this solution will help others in the future.
Here is the sample project on which I have been working…
https://4a1e8691fb88b7b41341-80de7026d6700afa799b216d7fcde2cf.ssl.cf2.rackcdn.com/MultipleMasterDetailViewsWTab-iOS8.zip
Anyway, I would appreciate your help to figure out what I am doing wrong.
Thanks for your time and assistance,
Mike
displayModeButtonItem() method handles the left UIBarButtonItem for you.
The UISplitViewController act differently between iPhones and iPad.
In your case -iPad in portrait mode- the master ViewController is presented as a popover, so you shouldn't have a back button nor a title on it, because you are not trying to go back, you are presenting a popover.
Since iOS 8 there is no UIPopover. The underlying UISplitViewController handles the master (primary) and detail (secondary) UIViewControllers and "vends" the displayModeButtonItem. Ideally, the title of that button should be the title of the top UIViewController of the primary viewController stack. It isn't. I've had some luck, when the master root controller is a UINavigationController, setting its title to match its topLevelController's title, but there are still cases where that technique doesn't seem to work.
Related
I'm developing an iOS 10 app using NavigationController and Storyboards. I'm having a difficult time to figure out whats going on with a strange - as I'm calling it - bug:
When I navigate to a new ViewController, it show's nicely, but when the app unwind a segue, the top view controller doesn't go all the way to the right, instead, it left's about 50 points on screen, and then suddenly it goes away...
I'm putting a image that illustrates what I'm talking about...
PS: both ViewControllers uses UIImageView as background...
Thanks a lot!
Please share the code where you are setting the fame for the view(s). It could possibly be an offset that is being added. Though, you do mention that it does go away suddenly, so it could be something else.
I have an UISplitViewController in a TabbarController, it works fine until I left the SplitView in portrait mode and change in my other view to landscape and go back to my splitview tab.
After that my controller try to call willPresentViewController and this fails with
2012-11-08 10:08:27.047 app[77747:c07] *** Assertion failure in -[UIPopoverController _incrementSlideTransitionCount:],
/SourceCache/UIKit_Sim/UIKit-2372/UIPopoverController.m:510
I thought it happened because the splitview didnt rotate when I came back.
I tried this control https://github.com/grgcombs/IntelligentSplitViewController but it didnt work either.
I can resolve it a bit but I have the problem now that the master in landscape is always black when I rotate in the kind I described.
The whole "leave tab, rotate, come back to tab" can be a pain because inactive tabs don't get the rotation events.
In the past I have used two different ways to solve the issue:
Create a custom sub-class of the UITabBarController which forwarded rotation events to UIViewControllerseven if they were not the active tab.
Have the UIViewController which needs to know about rotations use the NSNotificationCenter and register for the event UIDeviceOrientationDidChangeNotification
Which one I used really depended on how many of my tabs needed to track that information. If 1 tab needs the info, #2 is probably the direction to head, but if 4 out of 5 need it, then #1 is probably the way to go.
I am trying to set up a UISplitViewController in a Storyboard with the detail going to a UITabBarController which then goes to a UINavigationController wrapping my first ViewController.
The problem I am having is getting the UIBarButtonItem to show up in the Navigation Item when the device is in the portrait orientation. Should the UITabBarController be the delegate for the UISplitViewController and send delegate message to every child view controller to have them create the bar button item and popover?
I found need for this same solution. I am using it in one of my prototype applications for home-control.
The problem you cite is only the first of a couple of problems you'll run into. I believe i have full the solution now working for both iPad/iPhone (Universal app).
You can read my post here: problem and solution description with sample code at my blog
In summary, you'll run into the following issues (most for iPad imple., some for iPhone imple. when building Universal app.):
The template code in appDelegate sets up delegate incorrectly for the new shape (it really no-longer understands what type of controller is present for the detail view
UISplitViewController delegate calls are not propagated thru the UITabbarController to the tabs correctly
You will need to decide how/when to notify the tab(s) of the current detail selection
When building as Universal App some of the notification now need to happen in prepareForSegue: methods (as some of the other notifications don't happen on the iPhone platform.)
(All of this is shown at my blog post)
You can find example and theory in this site. Very good example.
My app should have a back end for the admin to change some settings, but in the back end view, I want to use a uisplitviewcontroller,
also the app only works in landscape mode,
the problem is that I have read the uisplitviewcontroller is only used in a root view scenario,
the other problem I noticed is that if I make a test app with uisplitviewcontroller (in root view) as in template, but put the app to only work on landscape mode, the right part of the uisplit doesnt show,,
so what to do? to accomplish a splitview kind of settings happening? (in second view)
* uisplitviewcontroller in a second view (how to make the landscape by default work??)
* uisplitviewcontroller faked with a table and loading views on the right side?? (how to do this??)
thanks!!
so, Im still customizing it,
but I ended up using this
APSplitViewController – a custom SplitViewController
thanks to the developer that this this
I'm working on an iPad app that uses a UISplitView. Inspired by http://blog.blackwhale.at/2010/04/your-first-ipad-split-view-application/, I display a button in my detail view when in portrait mode that shows the popover controller. This works great. However, the appropriate UISplitViewControllerDelegate message is only sent when the device rotates. So, when the app first loads (in portrait mode), my navigation button is not visible.
Is it possible to somehow convince the UISplitViewController to send that message on load or something, or do I need to re-implement my own popover logic to get things working?
Thanks,
-Patrick
We had the exact same issue and it turned out that this thread had the right clues. When comparing our app with the SplitView template, we noticed that the split template does exactly what was mentioned here: set the UISplitViewController as the root view controller in application:didFInishLaunchingWithOptions.
Out previous solution linked the split view controller in the XIB directly to the window. While this works it seems the split view has difficulties getting the startup orientation and the missing button occurs. When we removed the link in the XIB and created it in code in the app delegate, everything ran fine.
That's weird. Maybe you missed something. Take a look at the template based on a splitController. It works fine form very startup no matter in what mode the app was loaded.
did you make sure that your UISplitViewController's view is the only subview of your UIWindow, and that you added it inside the application:didFinishLaunchingWithOptions: method of your app delegate