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

nested tableview with automatic dimension

I have a TableView that its cell contains a second TableView (Nested TableView). Inner tableView shows comments that have variable cell height. Calculate this height with UITableView.automaticDimension. But main tableView cannot calculate it's cell…
0
votes
1 answer

Autoresizing UITableViewCell with UITextView which has text aligned to vertical center simultaneously?

Cell contains multiline text so I decided to use text view. textView.textContainerInset = UIEdgeInsets.zero removes extra padding. Code to center it vertically: extension UITextView { func centerVertically() { var topCorrect =…
0
votes
1 answer

Swift automaticDimension Cell Height not Working

My UITableView cells for a messaging ViewController only get the right height dimension when I scroll up or down the tableview and sometimes when I send a new message. I have seen most people solve this with cell.layoutIfNeeded but for me, it does…
olle
  • 134
  • 3
  • 15
0
votes
1 answer

UICollectionView inside UITableViewCell with UITableViewAutoDimesion

I am working on a project needs to add a UICollectionView(horizontal direction) inside UITableViewCell. The UITableViewCell height is using UITableViewAutoDimension and each UITableViewCell I am having a UIView(with a border for design requirements)…
0
votes
1 answer

UITableView height equal to contentSize height

I have a scroll view and inside of if couple labels and a tableView. I would like for that tableView to be scrolled by a outer scrollView and not the tableView's scrollView, so what I did is to set constraint for tableView height to be equal to…
0
votes
0 answers

Why do cells jump when scrolling?

I work with UITableView with cell that hold label with numberOfLines = 0, it means that cell can show 1 line or 20 lines. my problem is that the scroll not smooth. ** estimatedRowHeight didn't helped. class SingleTopicControllerV2:…
Hen Shabat
  • 519
  • 1
  • 6
  • 19
0
votes
3 answers

How to set UITableViewCell height depending on device screen objective-c

Below is the code I had tried but it's not helpful please check. static CGFloat cellDefaultHeight = 180; CGFloat screenDefaultHeight = [UIScreen mainScreen].bounds.size.height; CGFloat factor = cellDefaultHeight/screenDefaultHeight; return factor *…
0
votes
0 answers

Automatic TableView Cell height not working properly

I have a tableView Cell like this in storyboard as shown in above image. I defined required things in controller necessary for dynamic cell height like this : func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat…
Shivam Tripathi
  • 1,405
  • 3
  • 19
  • 37
0
votes
3 answers

Constraints in UITableViewCell not working

I've been trying to figure this out for days. I can't get the constraints to work on this UITableViewCell. These are the constraints I have. but it comes out like this The red is the cell background, cyan is the UIImageView background, green is…
0
votes
1 answer

UITableview Inside Another UITableView

How to handle table view inside another table view with height as UITableViewautomaticdimension ? The content inside the inner tableview is dyanamic
0
votes
0 answers

Capturing UIImageView bounds/frame size with TableViewCell autolayout

I am using the attached prototype cell layout in a tableview. Each cell is sized using autolayout: tableView.rowHeight = UITableViewAutomaticDimension The "tagline" is a string and sets the height of the cell depending on the length of the string.…
jz_
  • 338
  • 2
  • 14
0
votes
2 answers

TableView cell height not according to collectionview height on first reload

I know this is already asked in many threads but none of the solutions are working for me. Problem scenario is: I have a collectionview in tableview cell. The constraints on collection view are as: Collectionview top, leading, trailing and bottom…
0
votes
0 answers

Dynamic table cells with ability to reloadRows

By receiving data from an API, i need to compose a dynamic form. This in my head translated to a tableView with cells that have labels and input fields. The task was completed, the cells were dynamically sized depending on the constraints, all was…
Return-1
  • 2,329
  • 3
  • 21
  • 56
0
votes
1 answer

UITableview height changes automatically to full screen if section header is provided

I have a custom view on top(search icon/bell) and tableview(with a tableheaderview) below it. If I provide a section headerview to the tableview, tableview does not respect constraints - tableview takes the full screen height automatically, let…
0
votes
1 answer

Dynamically increase UIView Height when Tableview Height get Increased Using Objective C?

I have Implemented tableview named as mytableview inside UIView in UITableviewController named as maintablevew,and also I dynamically increased mytableview height based on cells count.it getting Increased Dynamically,Here my problem is when…