Troy
Troy

Reputation: 21872

How do I add a footer to a UITableView using Storyboard?

Same as this question, only the proposed solution doesn't work for me. When I drag a view to the bottom area of a tableView, it tries to add it to the list of cells higher up:

example

I'm sure I'm missing something simple... I'm new to storyboards.


EDIT:
Maybe it is adding a "footer" (though, it doesn't label it as such), it's just not adding it low enough. I was ultimately hoping to add an item that would appear at the bottom of the screen (and stick to the bottom of the screen).

Upvotes: 1

Views: 3651

Answers (3)

Rahul K Rajan
Rahul K Rajan

Reputation: 796

Either you can create a footer view programatically or you can load a view from UIView outlet

UIView *tempFooter=[[UIView alloc]initWithFrame:self.Footerview.frame];
[tempFooter addSubview:self.Footerview];
self.ItemDetailsTable.tableFooterView=tempFooter;

self.Footerview //View outlet

You need to set all the needed constraints of the self.Footerview to get the required layout of the footer view.But you don't need to set constraints for tableview footer itself.

Upvotes: 0

Michael Lorenzo
Michael Lorenzo

Reputation: 663

  1. Create a New UIViewController
  2. Insert a UITableView
  3. Resize the tableview by dragging its dimensions

enter image description here

The attached picture has a UITableView on TOP of a UIViewController's UIView. Make sure that you set the delegates in the UIViewController's .m, assign the tableView as a property of the view controller, and then set the tableview's delegate property to the UIViewController object. i.e.: tableView.delegate = self or [tableView setDelegate:self]; also with datasource.

OR you can just click the tableView, on story board, and then drag its delegate and datasource property to THE UIVIEWCONTROLLER! not the view! You can do this by dragging it to the this highlighted part of the view controller's toolbar on the storyboard:

enter image description here

Upvotes: 0

Shaunti Fondrisi
Shaunti Fondrisi

Reputation: 1091

TIP: You can use the Tree view (outline view) on the left to arrange the Views (and sub views). I have done a lot of storyboard editing, and dropping things into table views rarely go to the correct hierarchy level in the tree view.

Upvotes: 1

Related Questions