Dynamically size uitableViewCell according to UILabel (With paragraph spacing)

前端 未结 4 1143
粉色の甜心
粉色の甜心 2020-11-29 13:24

I have a UITableView which is populated by text and images from a JSON file. The TableView Cell is currently sizing correctly for "posts" that do not contain many

4条回答
  •  迷失自我
    2020-11-29 13:56

    Implement this table view delegate method:

    -tableView:heightForRowAtIndexPath:

    https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:heightForRowAtIndexPath:

    You'll call your method for determining the height and return that value with some extra padding if you wanted.

提交回复
热议问题