How could i get a toolbar with tableview to get buttons on that?
I solved this in my apps by adding a toolbar to a UIView and then add the table view to the UIView, too. This fixes the toolbar on top and allows the table to scroll. UITableView itself does not allow adding subviews.
See also here: UISplitViewController: how to get toolbar if details controller is UITableView?
Related
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.
I created a MasterViewController project with a tableView, now I'd like to add some tabs to this. I tried to just drag and drop the tab bar into the MasterViewController and the tabs show, but they are linked the the last cell in the tableView.
Is there any way to make the tabs stay in place so they are always displayed? What I am trying to accomplish is to give the user buttons to push to organize the data in the tableView, so I'm open to other suggestions.
Here are the pictures:
You need to have your controller be a UIViewController, not a UITableViewController (where the table view is the controller's self.view, and is full screen). If you use a UIViewController, you can add a table view, and size it such that you have room at the bottom to add the tab bar. In that case, both the table view and the tab bar are subviews of the controller's self.view. The way you're trying it, the tab bar is added to the table's scroll view.
It sounds like you added it as a subview of the table view, so as the table view scrolls it scrolls too. Look at creating a container view to hold both the tableView and tab bar / segmented control / buttons positioned below it. You will need to make the controller a subclass of UIViewController instead of UITableViewController.
Alternatively, use the navigation bar to add some edit button(s), either to enter an editing mode which shows controls on each row or where the buttons actually edit the currently selected row.
Tab bars are container controllers and are used to present a different mode of your application. If you want to only organize your tableview data, my suggestion is to use UISegmentedControl.
I have a tableviewController class where i am displaying my content in the tableview. Here, i want to add a scrollview below the tableview but i am not able to change the tableview coordinates. My TableviewController is in turn added to a navigation controller. As of now i am able to add the scrollview using self.view addsubview:myScrollView but it is getting added to the tableview. When i scroll the tableview the scrollview is also getting scrolled vertically. But i want the scrollview to be fixed below the tableview and i just want my scrollview to scroll just horizontally. Please help.
It seems what is happening is that you are adding a UIScrollView on top of the view stack and so causing it to rest on top of the UITableViewController instead of beside it. This is not good.
You should consider using UIViewController instead of UITableViewController. You could then subview a UITableView with a UINavigationController and a separate UIScrollView to fit the screen how you want it.
This is a pretty major undertaking, so it will be hard to demonstrate a good answer in code.
What you need to do is make your view controller a subclass of UIViewController, then add UITableViewDatasource and UITableViewDelegate protocol in your header file. If you are instantiating in NIB, toss your Tableview instance and replace it with UIView. You then hook to your FilesOwner as your view. then bring in table view object from the library and hook its delegate and datasource to file owner and you should be good! Hope this work well for you. Work well for me all the time!
i'm having a tableview nib file.(contains a list)
i want to add some buttons with it
so i want to change the tableview to view and put the tableview inside that view
then add buttons to the view..
what to change in the class files and how to do this?
if you want to change the tableview to view, you can do in the IBOutlet.
By changing the value in the Inspector Identity from UITableView to view. So that it will change to view and you can add buttons and some to that view.
or else you can add the buttons with out changing the IBOutlet with code.
you can change the UITableView frame and you can add buttons to the view.
Regards,
Satya
Is it a Segmented Control?
About the featured view, is it purely a tableview? how could they make the Segmented Control to be permanent instead of scrolling with the table cells down below?
as Ertebolle says its a UISegmentedControl set as the titleView of the navigationItem.
You can also create elements within the view that don't scroll with the tableview by adding a UITableView as a subview of a UIViewController's view. Setting its frame property means that you can have a scrollable tableview in a fixed certain position in your view and other elements in the view that don't scroll with it.
Yes, I believe it is a UISegmentedControl. But it's set as the title view of the navigation bar - to reproduce the whole effect, you'd create a UINavigationController, push a UITableViewController as the top view in it, and set the titleView of the table view controller's navigationItem to that segmented control. This would automatically anchor the toolbar / segmented control on top.