How to add a button in the TableviewController? - ios

I was wondering how to add a simple static button at the bottom right of the Tableviewcontroller background, its will be contact infos.
I have tried through through the storyboard with no success.Do you have any clue for that?
Thank you ,
Regards,

Take ViewController and Add TableView inside it.
Take one View and set the bottom of the view controller and set button inside that View.

I would suggest you to make a normal ViewController, add a tableView and save an space for that button, take note that you have to set the delegates and datasource for that tableview.

You could use footerView if you want this button to appear only at the bottom of the whole TableViewController. To do that, you can drag a view after the cell in the hierarchy:

If you really want to use a UITableViewController, you could create a normal UIViewController, add a container in it and embed a UITableViewController in the container. Here's an example:

Create a UIView with UIButton and set this view as TableView's FooterView

Related

Why Does the TableView Show Under the Navigation Bar

I set my navigation bar to be transparent at the start. I also set a UIlabel at the top of my ViewController if it does not need to be transparent. This works for UIViewController, but if I use UITableViewController, I cannot add a UIlabel at the top of my view, because it is embedded with the UITableViewController and scrolls with the TableView. Below is a sceenshot which looks the TableView.
How do I fix this?
A UITableViewController can only be used if its view is just the table. This means that your view controller can't be a UITableViewController unless the table occupies the whole scene.
To work around this in a legal way, you need to construct a custom parent view controller, like this:
ViewController
child: UITableViewController
The ViewController's view now contains the label and the table view controller's tableView. Problem solved.
You can very easily configure this in the storyboard using a Container View to stand for the table view in the ViewController scene. Indeed, this is probably one of the most important uses of a Container View.
You can add tableview in UIViewController on place of UITableViewController.
In case of UITableViewController use it as fixed header and just uncheck the bounces of UITableViewController in utility area.
Hope this will help you.
you can use this in your viewDidLoad
if ([self respondsToSelector:#selector(setEdgesForExtendedLayout:)])
{
self.edgesForExtendedLayout = UIRectEdgeNone;
}

iOS Drawer and Header Image within SWRevealViewControllerSeguePushController

Ho can I add header image to SWRevealViewControllerSeguePushController menu in iOS?
For example like material drawer have it for Android:
Can I modify somehow that UI Table View controller to put some custom UI above the menu rows or any other workaround?
Make a seperate UIViewController.
Add your custom views and a tableView to it.
Make the Delegate and Datasource for the tableView your viewController class.
Also i'd recommend making an IBOutlet for your tableView so it acts just like a UITableViewController (which behind the scenes is a just a normal UIViewController with its view being a UITableView and the delegate and datasource for the tableView being the view controller itself.
Yes you can definitely modify. Use any viewcontroller in place of tableviewcontroller.You will be able to add anything on it's view and do whatever you want. Good luck.

Can't change the size of a TableView in Interface Builder

I'm trying to change the size of a tableView I have in interface builder and can't seem to. When I first started the app I could drag it around and stretch the sides but all of a sudden I can't adjust it. I tried to delete my tableView and add a new one but the same thing happened. Thanks in advance. Here's what I see when I try to change the size:
if your using a UIViewController you can drag and drop a tableView and can place in a custom position you want. but if your using a UITableViewController you cant move the tableView to your custom position. if you want to do it in UITableViewController you can do like below
if you want your tableView content should show from a point, that you want you can do this way,
[self.tableView setContentInset:UIEdgeInsetsMake(100,0,0,0)];
else if you want set your tableView to a frame in UITableViewController you do this way,
- (void) viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
self.tableView.frame = CGRectMake(0,100,320,300);
}
hope this will help you.
What kind of view controller are you using to manage your table view? Since you show "prototype cells", I'm guessing it's a UITableViewController. Those are built to fill the entire screen with a single table view (which has always annoyed me.)
Starting with iOS 6, though, you can create a "container" view in another view controler, and then drag an embed segue from your container view onto the table view controller. That does all the housekeeping to make the table view controller a child view controller of the other one, and then you can make it whatever size you want.
If you don't want to use a UITableViewController as a child of another view controller, you can use a regular view controller and wire up the data source and delegate methods yourself. However, things like static table views and prototype cells don't work then.
Hopefully this helps someone still coming across this problem. What I did was make sure the UIViewController had a UIView as its direct child, then dragged the UITableView as a child of the UIView, this allowed me to resize the UITableView.

Floating button over UItableview using storyboards

I have made a table view using prototype cells on tableviewcontroller from storyboards.
I want a floating button over that uitableview. (button won't scroll with the tableview).
While searching for a solution..I found out that it is possible by adding button to the superview (in that case Uiviewcontroller subclasses Uitableview).
Can any one tell me how to do that using storyboards??
I think best thing you have to do is to create a UIViewController and add it a UITableView. Then you can add also the UIButton you want to the view controller's view. Don't forget to set the view controller to be the delegate and data source for your table view, and to add <UITableViewDataSource,UITableViewDelegate> to your view controller interface.
If you must do it using Storyboards and not in code, then you need to use a UIViewController and not a UITableViewController.
Add the UITableView and make it full screen - link up its Delegate and DataSource to the UIViewController and adhere to the two protocols in the .h file of your UIViewController.
When adding the button, drag it into the view hierarchy in the "Document Outline" sidebar, and not by dragging it onto the UITableView. Be careful if you're ever dragging the button around the view because if you drag and drop it on top of the UITableView then it will become a subview of the UITableView. If you want to move it around you'll need to select it and then use the arrow keys.
Anyway, apart from that it should all be very easy - add your constraints to keep it in the right place and you should be able to use the button as normal.

Using UINavigationController for inner UIView

What I have an iphone screen with a main UIView which has another UIView inside it with the size of 280x280 which has a tableview inside it. What I want is that when a user selects any row of that table inside that inner UIView, it pushes the user to another 280x280 UIView, so basically the main view is going to be fixed but only the inner view changes. What's the concept that can make this happen ?
Thanks in advance.
I think that user994813 wants to say this:
A UINavigationController controls the total screen. So, only pushing
and popping a 280x280 field is not possible.
The best way to achieve this would be to let a UITableViewController
be the controller of the main view. Use this as delegate and datasource
for your 280x280 tableview.
When a user selects a row, use a transition to let the tableview
disappear and the other 280x280 view appear. In other words, I fear
that you have to do this manually, although it's not very hard.
If you need a NavigationBar, create it manually in interfaceBuilder.
you need to create two 280*280 view one for your tableview and another for other(push view) and whenever you select table row you need to hidden true first view and hidden false second view(pushview).

Resources