How to get an additional toolbar at bottom of UISplitViewControllers root controller? - cocoa-touch

When using the standard UISplitViewController setup, there's a toolbar/navigation bar at the top of the left panel.
I would like to add an additional toolbar at the bottom and tableview in the middle, which is managed by the navigation controller.
Can anybody point my to an example?
Info: I'm using IB.
Thanks.
René

The "easy" way to accomplish this is to create a parent ViewController, housing a subview (your current UISplitViewController), and at the bottom of that VC place your toolbar.
If the events need to be passed from the toolbar to the VC, this would best be accomplished using Events and wiring the two together in the newly created parent ViewController.
Optionally, you could create a toolbar in code and add it to the detail view (or even the parent UISplitViewController as an overlay) with the .Add or .AddSubView - just be sure to set the proper frame. This might potentially overlay real estate on the detail view, so you'd want to adjust the frame there as well so that you can access all of the view.

Related

Storyboard with NavigationController and TabController

It seems like this should be easy to figure out, but I haven't had any luck this afternoon. I threw together this quick, simplified storyboard mockup of my problem.
Basically, I would like the table view controllers below to also be in a tab bar controller (in addition to the already present navigation controller). The tabs would switch between the two table view controllers.
Right now, the view controller with the buttons acts as a sort of menu. Each button leads to one of the table view controllers. Ideally this view controller would not have the tab bar visible, and would only be reachable from back buttons on the nav bars of the table view controllers.
I've tried a few different ways of embedding into a tabbarcontrollers but none of them produce the desired result:
-I've tried selecting both table view controllers and embedding those in a tab view controller. The tabbar doesnt show up in simulator, and the 'unreachable scene' warning appears.
-I've tried embedding the initial nav controller into a tabbarcontroller. This creates a tab entry for the first 'menu' page. It also causes issues with push segues once I connect the tableviews to the tabview.
I would be fine implementing some programmatic options on top of the storyboard, I just chose storyboarding for this project since it's a relatively simple presentation of data.
What is the proper way of going about this? Thanks!
A tab bar controller needs to be the root view controller of your view hierarchy. It goes against the HIG and Apple's standards to put a tab bar controller inside of any other type of container controller.
From the Apple docs:
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.
So, the bottom line here is you need to rethink your design. One option would be to set the UITabBarController as the root view of your window, and then have each of your UITableViewControllers inside of a UINavigationController, which is placed inside of the UITabBarController. In this way, you still get the navigation bar, and stay within Apple's design guidelines (you also won't get those pesky warnings, and Apple may even be throwing an exception nowadays if you try to install a UITabBarController as anything other than the root view of the window).
I accept JMStone answer but we might get into situation where we need to put tab bar controller inside other controller especially table view controller.
Please refer Storyboard navigation controller and tab bar controller
and also the good example by Matthjin: http://cl.ly/VQLa
Hopes it help some one who want to put tab bar controller inside table view controller and wants proper navigation.

How to Create UITabController on a Button Click

I am working on app. It has normal 3 views. On third view, I have a table view. If I select any row, I want a view which contains UITabController. I have created a simple UITabController app, but unable to do this. How to do this ?
thanks in advance
IMHO, your question is perhaps ill conceived.
A tab bar controller controls view controllers which in turn control views. Your suggestion that a view contains a controller of controller simply does not make sense.
Maybe what you really want on selecting a row in your table view is to present a new view controller and then make the (existing) tab bar visible.
You usually want a UITabBar to be THE navigation for your application and not show it later on one view.
But if you want to do so you should show, as Mundi said, a new UITabBarViewController when you select your UITableViewCell.
I don't know your exact usecase, but if you work with a UITableView I would use a UINavigationController to push a new View when you tap one UITableViewCell. Then it may be better (If you have 2-3 Elements) to use a UISegmentedControl in the UINavigationBar. This would look like this.

how do you resize (visually, not programmatically) the detail view of a UISplitViewController in a storyboard?

In IOS5, with storyboards, suppose you have a UISplitViewController, which has some views that are set up as its master and detail views as normal. One of the detail views is set up as the initial detail view controller for the UISplitViewController, and thus its size, in the storyboard, is that of a normal detail view. Other detail views segue from this detail view, and because of the segue relationship, are also sized as normal detail views.
And, of course, they all dynamically resize when you change the device's orientation. So far so good.
Now suppose you add another UIViewController, which you are intending on using as the detail view for the UISplitView. In this case, however, you will be programmatically making it the detail view, instead of using a "replace" segue.
On the storyboard, this view will be full-sized, i.e. it will not look as though it is a detail view. This makes laying out the interface in the storyboard a problem.
In the attached screenshot, you can see that the view on the far right is a full-size view. I want to make it detail view sized in the storyboard.
How is this done? I've tried various combinations of sizes and options in the attributes inspector, but nothing seems to have much effect. The obvious choice would be "Size: Detail" in the "Simulated Metrics" section of the attributes inspector, but this appears to do nothing.
If I understand your question (resizing a viewController), I've done it through selecting Freeform in the Size box, then clicking on the view and setting its size through the Inspector.
fwiw - I haven't found a way to resize things like nav or tab controllers.
EDIT: After selecting "Freeform", click on the View, then set the size in the Identity Inspector tab as shown below (don't know tab name)

UIPopoverController buttons beneath a table view

I was looking to implement something like the image below, and really have no idea how it's done and was wondering if someone had a quick design idea (no code is necessary or anything). Is it a footer view for the table view? is it some unknown footer view for a popover controller? Is it some way to integrate a toolbar from the UINavigationController 'into' the popover? I guess I could always create a custom view and display it 'like' a popover. Thanks for any help.
UIPopoverController will actually do a lot of that for you. If you set its content view controller to a UINavigationController, the contents of that navigation controller’s current view controller’s navigation item will display embedded in the top of the popover. I believe setting the view controller’s (not the navigation controller’s) toolbarItems will have the same effect at the bottom.
In this case, it looks like they wrote a custom popover controller; it doesn’t have an arrow attached, and the top of it is shaded a little differently from the standard UIPopoverController. But I’m pretty sure you can use the methods I just described to achieve a similar effect without having to roll your own popover.

UISplitViewController: how to get toolbar if details controller is UITableView?

I checked out Apple's example on how to exchange detail views in the UISplitViewController and it seems that they put the UIToolbar in every detail controller. Then, if the device is rotated, they hide the toolbar or show it and add a popover button which will show the root controller.
I'd like to adopt this pattern to show my root controller in a popover using a button in the toolbar, but unfortunately, my detail controllers are all UITableViewControllers and they do not allow adding other UI elements than a table view. So how do I deal with that? Is there an example around?
René
I think I figured out by myself: DON'T use a ´UITableViewController´ and a UITableView as root view in your NIB, as you cannot add a UIToolbar to the table view.
Instead: In the NIB, put a standard view and drag a UIToolbar and a UITableView on it.
Connect the standard view to the controller's "view" outlet.
Add another outlet and make it a UITableView. Connect the table view to it.
In the code: Let your controller inherit from UIViewController and not from UITableViewController.
Add a property to your controller to get the TableView to make it look compatible to UITableViewController.
public UITableView TableView
{
get { return this.viewTableView; }
}
Upon the viewDidRotate event you will have to adjust the table views width and height now (UITableViewController did that job for you before):
this.TableView.Frame = new RectangleF(0, 44, this.SuperView.Frame.Width, this.SuperView.Frame.Height);
The 44 pixels com from the parent view's toolbar.
I don't miss UITableViewController. I know there are some issues like automatic scrolling when editing, but in my case this is simply not needed.
René
Check out this example and the corresponding code. If I understand your question, this should show you how to do what you're looking to accomplish.
Also, just as an FYI to everyone, another MT user MonoTouched the MultipleDetailViews example that you linked to above.