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
27
votes
6 answers

Minimum cell height with UITableViewAutomaticDimension

Is it possible to set minimal height for cell? I use dynamic: tableView.estimatedRowHeight = 83.0 tableView.rowHeight = UITableViewAutomaticDimension But I need to set minimal height for cell when my news title label text is in one line.
aaisataev
  • 1,643
  • 3
  • 22
  • 38
17
votes
7 answers

Error: UITableView jump to top with UITableViewAutomaticDimension

I am using UITableView with estimatedRowHeight and UITableViewAutomaticDimension. Also I am using NSFetchedResultsControllerDelegate to reflect the changes. Everything is work fine. Now the problem is when ever I add some record to CoreData,…
Tapas Pal
  • 7,073
  • 8
  • 39
  • 86
15
votes
6 answers

UITableView Section Header Automatic Height Not Updated Properly

I am running into an issue with automatic/dynamic UITableView section header views that contain a UILabel that wraps (numberOfLines = 0). The height is not being calculated properly, especially once you scroll the table and the views are reused. …
11
votes
1 answer

How to perform updates on UITableView while scrolling using CADisplayLink and UITableViewAutomaticDimension without jumping?

Link to the subclass of UITableView I want to find out why UITableView jumps while scrolling. How to perform some changes on UITableView along with setting its contentOffset? This is how I set up my scrollDisplayLink: scrollDisplayLink =…
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
10
votes
1 answer

Expand UILabel inside UITableView with "more" button like Instagram

I've got a project (that has been written by other people) where there's a feed with content and text displayed inside a table view. Each post corresponds to one section in table view, and each section has its own rows corresponding to elements like…
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
8
votes
4 answers

UITableView Automatic Dimension Not Working Correctly

I have a tableview that is getting populated with data from Firebase. However, when resizing the tableview using automatic dimension, some text is shown getting cut off. Here is my Storyboard with constraints set to top, bottom, right, and left. It…
user3667192
  • 103
  • 1
  • 6
8
votes
2 answers

UITableView self sizing cell scrolling issues with big difference of cell height

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ let json = JSON(data: activityTableView.onlineFeedsData)[indexPath.row] // new if(json["topic"]["reply_count"].int > 0){ if…
Mukesh
  • 3,680
  • 1
  • 15
  • 32
7
votes
0 answers

Custom UIView in UITableView cells with UITableViewAutomaticDimension enabled

I have UITableView with UITableViewAutomaticDimension and some estimatedRowHeight. For this table I am using custom UITableViewCell which contains some label and custom UIView with overridden intrinsicContentSize(). Constraints setup is correct and…
7
votes
6 answers

UITableViewAutomaticDimension not working on iOS 8

I was following this tutorial to make self sizing cells. I registered custom cell into table view and in the cell xib I gave every subview constraints manually. Please refer to the source code in GitHub Arranging 3 labels vertically in one cell's…
6
votes
4 answers

TableView Automatic Dimension Tableview Inside Tableview

I have Tableview for showing food orders placed by clients. which contains Horizontal UIStackview. In UIStackView In UIStackview There is few one / two lined label and one UITableView which is used to show orderItems. Inner tableview has fixed …
Prashant Tukadiya
  • 15,838
  • 4
  • 62
  • 98
6
votes
1 answer

UITableView cellForRowAt vs willDisplay

I'm a little frustrated. I have a iOS 10 project UITableView with UITableViewAutomaticDimension cells. I set constraints properly. Initially I was mapping my cells inside func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath)…
AlexZd
  • 2,152
  • 2
  • 18
  • 29
6
votes
2 answers

Custom UITableViewCell with auto layout and accessory view

I have a custom table view cell that uses auto layout and has a disclosure indicator as an accessory view. The cell size of the cells on the screen are completely wrong when first displayed: As you can see the cell is taking about a 1.5 screens…
5
votes
1 answer

Ambiguous UILabel height in autoresizing UITableViewCell

I am having a hard time making my implementation of UITableView with automatic cell sizing. I am trying to use a UIStackView with 2 labels inside cell with automatic size. It looks good overall but I am getting the following runtime issues: I feel…
5
votes
1 answer

How to change height Constraint of UIView in UitableviewCell when using UITableViewAutomaticDimension

I have a UIView in the UITableViewCell , which needs to change its height when user taps on "less/more" button My code is - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath { return…
5
votes
1 answer

UITableViewAutomaticDimension Not Working for Resizing Cell Height

My cell displays fine as long as I don't try to enable the automatic resizing. When I add the two lines for auto-resizing in my viewController, everything under the profile picture, username, and date disappears (the cell is supposed to look like…
Connor V
  • 231
  • 3
  • 15
1
2 3
9 10