Skip to content

A test project for resizing a UITableView tableViewFooter using autolayout.

Notifications You must be signed in to change notification settings

cmittendorf/TableViewFooterResize

Repository files navigation

Resize a UITableView footerView using autolayout

My goal is to create a tableFooterView that does resize itself by being connected to the contained UILabel.

If I put the layout constraints on the UILabel to keep a constant space to all four edges plus that the height of the label can extend.

layout constraints in Interface Builder

Using the constraints shown above, the label won't resize at all, as you can see from the first screenshot.

tableFooterView with autolayout constraints

But if I remove the bottom constraint so that the label view can increase it's height, the label is growing as I would expect.

removed layout constraint in Interface Builder

tableFooterView with missing bottom autolayout constraints

The table view does get the size of the footer view by assigning the footer to the table:

[self.tableView setTableFooterView:_footerView]

Resizing the footer view won't inform the table view about the new height.

What am I missing? At what point should I update and inform the tableview about the new height of the footer view?

Update

Thanks to the pull request of phaibin the problem described above is solved:

tableFooterView with fixed autolayout

For further details see: http://prod.lists.apple.com/archives/cocoa-dev/2014/Jun/msg00127.html

Updated the example to create a tableview that requires scrolling.

About

A test project for resizing a UITableView tableViewFooter using autolayout.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published