How to make UITableView's height dynamic with autolayout feature?

后端 未结 5 1328
抹茶落季
抹茶落季 2021-01-31 03:32

I am using autolayout in Xcode 5.

I set the table view\'s height to Greater than or equal to 200px. I want that it has dynamic size. Because sometimes it will have many

5条回答
  •  清酒与你
    2021-01-31 03:52

    It can be done programmatically. The concept (and code itself) is actually very simple:

    In the updateConstraints method of myTableView's superview, add a constraint so that myTableView's height is equal to myTableView.contentSize.height.

    Tested on Xcode 6 targeting iOS 7.

提交回复
热议问题