Code Monkey home page Code Monkey logo

tableviewfooterresize's Introduction

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.

tableviewfooterresize's People

Contributors

cmittendorf avatar phaibin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

phaibin

tableviewfooterresize's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.