Static Tooltip below UINavigationController - iphone

In my application, I have an UITableViewController inside an UINavigationController in storyboard. What I am trying to do is to have a static tooltip (UIImageView background and an UILabel) right below the UINavigationController so that when my table scrolls, the tooltip will NOT move along with it. Is there any way do accomplish this without using XIB files and just storyboard?

Might not exactly be what you wanted, but if you want a UITableViewcontroller and setting things up using only storyboards:
the easiest way would probably be to either use the navigationbar (make it bigger by choosing "with prompt") or the toolbar at the bottom, both in the attributes inspector of your TableViewController
or (depending on which functionalities you need) you could simply drag out a ViewController and put a TableView inside, then customize everything as you want

Related

How to "Dock" a UIToolbar to the bottom of the screen in UITableView?

I have a UIToolbar that I added to a UITableViewController in my Storyboard.
When this view is displayed, the toolbar will show itself directly below the last item in my UITableView. I want to "Dock" my toolbar on the bottom of the screen. I want it to display in the same place every time rather than move around depending on a variable number of table cells in my view. I need the user to be able to see all the cells as well (It can't be covering UITableView items, UITableView needs to decrease its allotted display space). How can I do this?
Edit: Using a UINavigationController to handle my views
You have a couple of options. The first and easiest of the two would be to use a UITableViewController embedded inside a UINavigationController, with the navigation controllers toolbarHidden property set to NO.
The other option is to use a UIViewController. A view controller has a UIView build in, and you can manually add and position a UITableView and a UIToolbar on it in this configuration. Both of these configurations will achieve your desired end result.

iOS navigationBar

this is probably quite simple.. but I don't know what's the best practice here.
i have a tabbarcontroller with 4 tabs, 3 of them should be a UINavigationController, the other one should also have the UINavigationBar to it but should not be a nav controller itself.
Now i want to give the UINavigationBar a tint color and an action button. I'd like to do this in the interface builder.
The navBar should always be the same one and i only want to create it once.
But where exactly would i do it? Would i create a .xib file with only the UINavigationBar in it and somehow link to that?
I'm very confused here, most tutorials only discuss the navBar for ONE navController but in my case i need the same bar for different ViewControllers..
NavBar comes with the navigationController or can come seperate. It is a subclass of UIView.
You cannot simply share your navBar with all controllers and the non-navigationController. I mean one instance of a navbar. You cannot even set the navbar for a navigationController. It is only readable.
In my understanding you are trying to make the navbar look the same in every controller, am I right?
So you can for instance subclass a UINavigationController and set it up as you want in the init method and init this subclass to add it to the view.
But what about the non-UINavigationController navBar?
Well, that's easy: Simply add your subclassed navigationController to that tab. You don't have to use it as NavController. You simply can add views to his view as to a standard ViewController.

How can I have a UITabBar instead of a UIToolBar on a UINavigationController?

I have UINavigationController with UITableViewController as the root view controller. UINavigationController has a an optional UIToolBar, but I want to have a UITabBar instead. I don't need a UITabBarControllerbecause I don't want selecting tab bar items to change the view, just the contents of the same view. My app is a basic RSS reader which displays the items in the table view and I want to use the UITabBar to select from 2 or 3 different RSS feeds, refreshing the existing table view in the process, not switching to a different table view.
If I add a UITabBar manually to the UITableViewController (as it seems impossible to do this form IB) it is anchored to the last cell in the table view, so not only is it not usually visible, but it also moves around. I can't seem to find any way to do what I want.
The solution will probably be to use a UIViewController instead of a UITableViewController. This way you can have both a UITabBar and a UITableView, both subviews of your view controller's view.
The UITableViewController class reference describes exactly what behavior UITableViewController provides over a plain UIViewController (such as being the delegate and data source, deselecting rows, etc.) — you should implement all this this so everything works as it should.
You can make the UITableViewController a UIViewController <UITableViewDelegate, UITableViewDataSource>, and then hook it up in a nib with your TabBar. You can find the UITableViewDelegate protocols here. Hope that helps!

XIB tableview ignore the size of the tableview goes to full screen

I have a XIB with a nav bar at the top and the tableview directly under that. both of these are placed under a UIView.
If I change the color of the table in the IB and run that app, the color changes properly. So I assume that I have the XIB loaded OK.
But the tableview take up the entire screen and the nav bar is hidden.
Is there a trick to this? Do I have to manually set the size (top) in the code, and if so how exactly do I do this?
You have to create set the file as a subclass of UITableViewController and you can either set the UINavigationBar as an outlet or allocate it in the viewdidLoad method -
Watch this tutorial to understand on how to set things up.
http://www.youtube.com/watch?v=LBnPfAtswgw

How to reliably place built-in UINavigationController UIToolbar on top of iPad view

I am trying to use the UINavigationController object's built-in UIToolbar object in my iPad application, but I want it to be displayed on top of the view instead of the bottom, which is where it defaults.
I am also hiding the UINavigationController object's Navigation Bar.
In order to make this work, I had to write the following code:
navigationController.navigationBarHidden = YES;
navigationController.toolbarHidden = NO;
navigationController.toolbar.frame = CGRectMake(0, 0, 768, 44);
This solution works with one exception: when the application Enters Background and Becomes Active again, the Toolbar is always repositioned on the bottom of the view.
I've tried moving the code from viewDidLoad to viewDidAppear:animated, and it still behaves this way.
First, is there any better way to approach this, and if not, how can I stop the Toolbar from being repositioned?
I've also instead decided to use my own UIToolbar object and add it to each view via a custom Base UIViewController class' viewDidLoad. However, this causes the Toolbar to animate when each view is pushed or popped because it is actually part of the view, which just seems "hokey".
Any ideas on possible solutions?
Thanks everyone!
It says in the documentation under UINavigationController's toolbar property that:
Access to this toolbar is provided solely for clients that want to present an action sheet from the toolbar. You should not modify the UIToolbar object directly.
This is sort of hackish, but you could make a UIToolbar yourself and add it directly to the window (i.e. over the navigation controller.)
You can use the category below to modify the UIToolbar class to achieve what you're after.
#implementation UIToolbar (setCenter)
-(void)setCenter:(CGPoint)center
[super setCenter:CGPointMake(384, 22)];
}
#end
The toolbar has limited functionality when used with a UINavigationController. It only provides a convenient way to manage the actionsheet in the toolbar.
From the docs: "Access to this toolbar is provided solely for clients that want to present an action sheet from the toolbar. You should not modify the UIToolbar object directly."
The solution I would use is to create a subclass of UIView with convenience methods to manage your actionsheet and any other custom functionality you need. This custom view can be shared across all views in the UINavigationController and placed where ever you like in the parent view. This will give you ultimate control of your custom top placed toolbar.