简体   繁体   中英

IB Custom UITableViewCell - Dynamic Height for cell and detailText

Im trying to create a table very similar to the Messages table,

It requires 3 labels, - Title - detailText - Time (on the far right side)

The detail text needs to be dynamic height and so does the actual tableViewCell

is it possible to make a dynamic height tableViewCell in IB?

Yes you can,

Just use this method to of the UITableViewDelegate

tableView:heightForRowAtIndexPath:

First, you need some NSString method to calculate the height of cell it needs. And in my experience, you need the tableView:heightForRowAtIndexPath as Cyprian said, and under different cell height, the cell returned from tableView:cellForRowAtIndexPath: should have different layout too, to present the multi-line strings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM