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
vote
1 answer

How can I use UITableViewAutomaticDimension when the baseclass implements tableView:heightForRowAtIndexPath:

I have around 30 view controllers that all have a common base class that implements "heighForRowAtIndexPath". Now we have recently removed iOS 7 support which exposes us to the nifty auto-height calculation with AutoLayout. I was just presented with…
1
vote
2 answers

How to get height of UITableView placed in another UITableView in Cell as childViewController

I'm struggling with wired kind of problem. I have UITableView with one cell. This cell is only holding containerView with childViewController (second tableView). My problem is that, first tableView(parent) must have UITableViewAutomaticDimension row…
1
vote
3 answers

UITableViewAutomaticDimension with imageview

I have a tableview that contains a custom cell. The custom cell has an imageview and a label. I want to resize the cell based on the text in the label because the imageview dimensions are constant. The imageview takes up the majority of the cell…
John55
  • 301
  • 2
  • 11
1
vote
1 answer

UITableViewAutomaticDimension Cells resize after scroll or pull to refresh

I have added a table view, and I am display image in the cells. I have also added this code: tableView.estimatedRowHeight = 175 tableView.rowHeight = UITableViewAutomaticDimension So that the cells resize depending on the image. When I launch my…
user5590595
1
vote
2 answers

autolayout UILabel's dynamic height calculation doesn't work when text is empty string?

in iOS 8, I have a UILabel in a UITableViewCell. I want the cell to have dynamic height according to UILabel's text. It works fine. But when the text is a empty string, it seems has a default height, but I want it to be zero. Here is what I've…
Gon
  • 1,135
  • 12
  • 22
1
vote
1 answer

How to change the height of UITableViewCell within that cell with UITableView with automatic dimension?

So far I tried: @IBOutlet weak var requestDateButtonBottomConstraint: NSLayoutConstraint! requestDateButtonBottomConstraint.constant = sender.selected ? 0 : 260 I also tried frame approach: var cellFrame = self.frame cellFrame.size.height =…
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
1
vote
2 answers

iOS8 Self-Sizing UITableViewCells containing multiline UILabels gets wrong height

My programmatically generated custom UITableViewCell contains several UILabel that can wrap the text: newLabel.numberOfLines = 0; newLabel.lineBreakMode = NSLineBreakByWordWrapping; I use these cells in a UITableView with the following…
1
vote
1 answer

Setting up constraints to drive UITableViewCell height for UITableViewAutomaticDimension

I have a custom tableViewCell and I am trying to set up constraints so that I can use tableView.rowHeight = UITableViewAutomaticDimension. For simplicity sake let’s say I have a uiTableViewCell whose content view contains only UIImageView. The…
nwales
  • 3,521
  • 2
  • 25
  • 47
1
vote
0 answers

UITableView choppy up scroll W/O images

After returning from a detail controller. I call scrollToRowAtIndexPath and it works as expected returning me to the row. If i continue to scroll down the tableview everything is fine, but scrolling up is extremely choppy no matter how slowly i…
0
votes
1 answer

Table view cell scrolling issue

I have a table view and collection view to display image. Table view for vertical scroll and collection view for horizontal scroll. The image is displayed as full screen for the device. But when I scroll vertically half of previous cell is displayed…
iron
  • 715
  • 1
  • 6
  • 15
0
votes
1 answer

How to make last row to cover the remaning unoccupied space of tableview

I have a tableview , it has two rows. Tableview's height is 700. The first row height is 150 and the second row height is 100 but I'd like the second cell to cover the rest of the space in tableview. I know I can use the below for tableview height.…
0
votes
0 answers

set dynamic height for the parent child tableView Swift

I have created nested tableView approach, In a view controller I set tableView and then nested tableView for the Cell. So its like Parent tableView and Child tableView. For adjusting content height tableView row height autoDimension I have created…
0
votes
0 answers

How to vertically overlap and hide labels in a custom UITableView cell with dynamic height and width to reduce cell size and save space

I have a messaging cell that has 3 rows of UILabel, 1. Sender Name, 2. Message 3. Sent Time. Initially, I was keeping an offset of 10 between each of the labels. But I realized that I was wasting space in cases where either the message was too small…
Parth
  • 2,682
  • 1
  • 20
  • 39
0
votes
0 answers

Aligning text to right side of table view cell whose height and width are dynamically set

I have a table view whose height is dynamically set and max-width is 100 less than the screen width. These cells are aligned to the left or right side to create chat bubbles. I want to align parts of the text to the right end for the cell aligned to…
Parth
  • 2,682
  • 1
  • 20
  • 39
0
votes
3 answers

UITableView Cell with dynamic height and width not getting reused properly

I have a UITableView cell with dynamic height and width. Initially, it works properly, but when reusing an old cell the constraints are not set correctly. I am deactivating all the old constrains and activating them again. I have also called…
Parth
  • 2,682
  • 1
  • 20
  • 39