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
0
votes
3 answers

Self-Sizing TableView Cells based on two subview's height

TableView Description tableView.rowHeight = UITableViewAutomaticDimension tableView.estimatedRowHeight = 60.0 Cell Description I have a cell with 2 Labels(Title, Description) inside a ContainerView and 1 ImageView as below. Cell height will vary…
Shyam
  • 366
  • 1
  • 2
  • 10
0
votes
3 answers

UITableViewAutomaticDimension-10.0

I am trying to set height of the last tableView row different from the others. Instead of creating a new cell etc, I want to "cut" 10px from the height of this cell. As I have set automatic dimension for height, I can't use a constant value. This is…
suppe
  • 71
  • 2
0
votes
1 answer

UITableView dynamic cells heights performance

I'm stuck in a performance problem in my chat-like UITableview. I've got three types of cells: Text Image/video Audio Currently I'm handling the dynamic cells height caching the size in a dictionary: func tableView(_ tableView: UITableView,…
0
votes
2 answers

Table View cell height with complicated structure and UITableViewAutomaticDimension

How to create automatic table view cell size with complicated structure, which contains big amount of subview? Here is an example of table view cell: For example, total height of table view cell is 220 px: Brown area - 70 px, green area 90px, red -…
Procurares
  • 2,169
  • 4
  • 22
  • 34
0
votes
1 answer

AutoLayout's systemLayoutSizeFittingSize works only with UILabels?

I just had to make a UITableViewCell with automatic height calculation using the method systemLayoutSizeFittingSize:UILayoutFittingCompressedSize. Until my view had UILabels and UIImageViews, everything worked great. When I needed to replace one of…
nr5
  • 4,228
  • 8
  • 42
  • 82
0
votes
2 answers

Horizontal UILabels inside a self sizing UITableViewCell

Question: How can I use constraints in a UITableViewCell using UITableViewAutomaticDimension when there are labels side by side which can each contain a different number of lines? I have a table with cells that contain labels side by side: I'm…
0
votes
1 answer

UITableview with Autolayout and NSFetchedResults controller cell layout bug on insert

I seem to be having a very strange problem with my UITableview cells and autolayout. So my tableview is set up as follows: I have a UITableView within a UIViewController that I created via Interface builder using Autolayout My tableview is using…
0
votes
2 answers

estimatedHeightForRowAtIndexPath called many times resulting in jerky uitableview

I am having a requirement in an app where almost each uitableviewcell is having different height. Also, many cells have Images (1,2 or 3) with text. Earlier I was using the heightForRowAtIndexpath but as usual, the performance was very pathetic with…
0
votes
1 answer

how to make tableview row height depend on its content

I'm making a tableView programmatically like this tableView = UITableView.init(frame: CGRectZero, style: .Plain) tableView.delegate = self tableView.dataSource = self self.view = tableView Then I'm setting its rowHeight value…
0
votes
3 answers

Dynamic Height in TableViewCell Not Working

I've spent over six hours researching and unsuccessfully attempting to create dynamic cells today. I've found a handful of great tutorials on it too. I'm doing something wrong and am hoping someone can tell me what. My app: The table starts empty.…
Dave G
  • 12,042
  • 7
  • 57
  • 83
0
votes
1 answer

How to set constraints to set height of UIView same as flexible height of adjacent view?

I have a view in storyboard with UIView that contains an image: When I compile the table, I get: But, in another case in storyboard without image: I get result: My UITableView is working with UITableViewAutomaticDimension The question is: How…
-1
votes
1 answer

Swift adapt height of view in base of your content

I have a view like this: The label that contains "1 X Pizza wustel" can contains some rows. Now if the label contains a few row all is ok. But if the label contains more than 3 rows I cannot display all rows. There is a way to increase…
bircastri
  • 2,169
  • 13
  • 50
  • 119
-1
votes
1 answer

Static tableview How do I make the last visible row to occupy remaining space in

There are 5 static cells. When I show all 5 cells, it's fine but If I hide some cell by returning height as zero and the last visible cell is not same as last cell of tableview in storyboard then confusion comes as to how to do that ? override…
-1
votes
1 answer

Is it possible to achieve expandable table header view?

I have implemented table view with expandable section i.e. the section user choose will have number of items for that particular category. For closed section there will be 0 items. Now for better UI purpose, I want to achieve following type of…
-1
votes
1 answer

Dynamic number of uibuttons in uitableviewcell with sections swift4

dynamic number of uibuttons in uitableviewcell with sections Hey guys I want to implement a UI like the one in the link above. The tableview has cells with sections and each section has a different number of uibuttons from the other. The number of…
1 2 3
9
10