Questions tagged [uitableviewautomaticdimension]

UITableViewAutomaticDimension is a constant value that can be assigned to UITableView's rowHeight property to enable mechanism of automatic cell's height calculation. Use this tag in questions about self-sizing table view cells. Related tags are [tag:uitableview], [tag:tableviewcell] and [tag:autolayout]

Useful information about self-sizing table view cells can be found at the Apple's documentation. Basic steps are the following:

tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 85.0

Also, in each table view cell you need an unbroken chain of constraints and views (with defined heights) to fill the area between the content view’s top edge and its bottom edge. If your views have intrinsic content heights, the system uses those values. If not, you must add the appropriate height constraints, either to the views or to the content view itself.

estimatedRowHeight property could be emitted if you have table view's delegate and have implemented -tableView:estimatedHeightForRowAtIndexPath: method to return own value for each row. This method should be lightweight enough to have minimal impact for main thread efficiency. Here you still can return UITableViewAutomaticDimension constant.

140 questions
-1
votes
2 answers

Setting tableViewCell height with greater than or equal to constraints

I have a UITableViewCell whose height needs atleast 106. I need to set the contentView height to increase if in case the label inside the cell surpasses the height 106. Here is what i did. Set up a containerView to fit all edges. Set the height…
Rakesha Shastri
  • 11,053
  • 3
  • 37
  • 50
-1
votes
1 answer

Setting label's width and height according to the text length within a UITableViewCell using UITableViewAutomaticDimension

I need a UITableView with cells like this: I tried and ended up in this: I used UITableViewAutomaticDimension with Autolayout (pinning the label to 4 sides of the superview and not giving a height constraint) and was able to give dynamic height to…
Aftab Baig
  • 279
  • 5
  • 16
-1
votes
1 answer

How to CORRECTLY increase UITableViewCell using UILabel's height

There have been so many answers to this question on stack overflow, please know that I have looked but all the solutions do not work for me. I have two UILabels in the cell, one has a definite width and height, the other which will be dynamic, I put…
-2
votes
2 answers

Tableview scrollToRow(at:at:animated) causing scrollViewDidScroll(_) to be called multiple times

I have checked all possibilities as to why my UITableView is behaving so oddly for the whole day. Finally, right now I noticed something strange. I needed some help in figuring out if what I noticed is true or the problem could be in someplace…
Parth
  • 2,682
  • 1
  • 20
  • 39
-3
votes
1 answer

Not able to reduce UITableCustomCell height in iOS using Swift?

I need to reduce the height of the UITableView custom cell, if their is no data for the optional labels to show. following image would be a great help to understand I tried assigning constraints constant value to 0 and 20 for the pre/post…
Mohit G.
  • 1,157
  • 2
  • 12
  • 22
1 2 3
9
10