UITabBarController containing UISplitViewController doesn't handle rotation on iPad correctly - uitabbarcontroller

I’m experiencing unusual behavior on an iPad in iOS 6.1.2 when using a UITabBarController with a UISplitViewController (which has a UITableViewController for the master view controller). If I have multiple tabs, of which at least one tab contains a split view controller, and I am in landscape mode while viewing the tab that contains the split view controller, then I switch to another tab, then move to portrait mode, then press the tab that contains the split view controller, what happens next is that the master view controller (a table view controller) will display the table view over top of the detail view, when it is clearly not supposed to be there. This behavior happens only the first time the app is loaded, but is consistent behavior.
This scenario is easy to recreate by simply creating a project that is a split view application that uses an iPad device and Core Data (didn’t try it without using Core Data). After the project is created, use the storyboard and add a tab bar controller and make it the initial view controller, then add a view controller seque from the tab bar controller to the split view controller. After that, only one change is necessary in code which is to change the one line in application:didfinishLaunchingWithOptions in the AppDelegate.m:
Change the following template code:
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
To:
UITabBarController *tbc = (UITabBarController *)self.window.rootViewController;
UISplitViewController *splitViewController = [tbc.viewControllers lastObject];
Perhaps I’m breaking some iOS rules, and trying to do something I’m not supposed to? All I want to do is to be able to tab between a few different split view controllers. Suggestions?

Take a look at this Git.
https://github.com/nalyd88/DCToolkit/tree/master/DCToolkit/DCToolkit
From what I understand the problem stems from the split view controller not updating it's orientation when it's not visible.
Here a subclassed tab view controller and split view controller are used which pass the message along.
Thanks to Dylan at http://objectiveseesharp.wordpress.com/ for this solution! I just found it.

Related

How to expose standard back button in view controller navigation?

I need users to be able to navigate a data hierarchy (master level, detail level) and to create new master and detail objects accordingly. Both master and detail use arrays for their model and TableViews for presentation
The navigation flow for this uses 2 navigation and table controllers like below. The + of the master and detail TableViews create new objects, the forstTableCell navigates to the second TableView using a segue:
While the screenshot shows "Done" right now even when removing that ButtonItem the slot remains empty.
I would like to show the standard back button instead: "< Middlewares" in this case. In the tests I've only been able to get the back button when navigating to a normal ViewController, but not to another NavigationController. Is it possible to have it between Navigation Controllers, too?
Simply remove the second navigation controller. If you use a push segue, your second view controller will still have the navigation bar. As long as you don't use a modal segue all view controllers that are pushed will have a navigation bar.
So your storyboard will look like this:
You will then automatically have a back button. If you want to change the text of it, go to your navigation item of your first view controller and change the back title accordingly as shown in this screenshot
You certainly want to have a title in your second view controller (something like "Add [whatever you want to add]". So simply drag & drop a UINavigationItem on your second view controller then you can also add UIBarButton items in your Interface builder
Controlling the look/feel of the Navigation Bar Buttons
You can achieve the behavior you want by opening the Document Outline and find the existing Done button. If you have a UIBarButtonItem type, you can simply change the type to Custom in the Inspector. Next add a regular button within the UIBarButtonItem (just bring the Navigation bar for the target controller into the zoomed in view of the storyboard/xib). This will allow you to drag a button onto the navigation bar.
Once you have a standard button you can add an image with the back arrow. Then add supporting code to use the pop behavior on the Navigation bar. Since you can have only one root navigation controller, you may want to remove the second UINavigationController and add a UINavigationItem from the objects library and then subsequently add the buttons, titles of your choice. This configuration will allow you to leverage all of the push and pop methods available, while retaining full control of the look/feel/behavior of the navigation stack.
More on customizing the look/feel/behavior of the UINavigation Stack can be found at: Navigation API Docs

How Can i put more of 5 tabs in a Tab Bar Controller?

:D
i'm have a storyboard with a TabBarController but when i do the relationship with my others seven view controllers in mi tab bar appears a "more" Tab, How can i put this seven tabs in one tabbar?
I´ll have to do manually? with a tabbarcontroller class? or implementing Tabbar Delegate in a uiviewcontroller, But i dont have any idea how to do this.
Thank You Soo much!
Please Help Me.
Thanks Again.
I believe Apple actively discourages people from doing this in their apps, and so do I. It is never done in the iOS itself, and I have never seen it in any third-party apps either, so users will probably be confused.
If you add more than five items to the viewControllers property, the
tab bar controller automatically inserts a special view controller
(called the More view controller) to handle the display of the
additional items. The More view controller provides a custom interface
that lists the additional view controllers in a table, which can
expand to accommodate any number of view controllers. The More view
controller cannot be customized or selected and does not appear in any
of the view controller lists managed by the tab bar controller. For
the most part, it appears automatically when it is needed and is
separate from your custom content. You can get a reference to it
though by accessing the moreNavigationController property of
UITabBarController.
Also refer this link for a possible workaround!
You can use any open source custom UITabbarControler or can create your own.
As created in this open source code. JFTabBarController a custom tabbar controller on Cocoa Controls

TabBar inside detail view of SplitViewController.

I am trying to embed a Tabbar in the Detail side of a Split View Controller. The way I have done is that in the Storyboard I have the TabBarController as the DetailViewController and from there I have a couple of Navigation Controllers hooked to views ( separate tabs which are of type DetailViewController).
The problem I am facing is that out of two tabs which I have added, only one tab shows the button for showing the Master view in the Portrait mode.
I am new to iOS development, and would deeply appreciate any help towards solving this.
Thank you for your time.
From the documentation for the UITabBarController: "When deploying a tab bar interface, you must install this view as the root of your window. Unlike other view controllers, a tab bar interface should never be installed as a child of another view controller."
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UITabBarController_Class/Reference/Reference.html

How to include UITabBarController in UISplitViewController?

Hello every one,
I found this universal app in github.Is their any sample iPad app related to link which have tab bar controller. I want to make a UISplitViewController in portrait mode just like in the Settings app with the UITabBarController. How can I do it? Please help me to overcome this problem. thanks in advance.
First of all, according to iOS guidelines a SplitViewController should be the root view controller of application. So legally you cannot add split View Controller on tabBarController. At least the view controller containing splitView controller must be on window OR must be root view controller
You will have to make tabBarController your root view controller and add a split view controller as one of the view controllers of tabBar. I have tried this successfully

How to show a ‘modal’ view (controller) *in* a tab bar interface without hiding the tab bar

I want to implement a ‘modal’ view like the ‘search’ view of the AppStore on the iPad.
When shown, it should:
Still show the tab bar. Selecting any of the items should take you to their view as normal.
No tab bar item is highlighted (because the search view is ‘modal’).
The closest I’ve come, with existing APIs, is:
On the ‘search’ view controller, set the UIModalPresentationCurrentContext modal presentation style.
Show ‘search’ view controller modal from the active view controller inside the tab bar controller (not from the tab bar controller itself).
However, this does not seem to be the right path:
View controller is shown underneath the status bar. I can work around that from -[UIViewController viewDidAppear:], but when changing the orientation of the device, this leads to all sorts of drawing issues and the controller, again, tucks itself underneath the status bar.
Tab bar item is still highlighted.
to keep showing the search bar just trim the modal view's hight so that it doesn't cover the tab bar.
For orientation changes, you just need to handle that by changing the view size and making sure the modal view is always brought to the front of all the views. You can modify that view's frame and contents programmatically or you can just create nibs for the orientations you want to support and load them up when it changes. Also note if you do change the view's frame programmatically you will probably need to resize/reposition fields as well.
For dealing with the tab bar, you should be able to turn off the highlighted item. So when you pop up the modal also make sure to turn off the highlighted item. If you want to interact with the toolbar from the modal view you can do that with delegates, passing an instance of the parent view (or just accessing parent view... I think you get that for free)