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

Load async images in tableview with different cell height. Swift

The thing is i am making a request that brings me back some images with different height that i want to autoresize each cell according to each image, but when i paint them in the tableview, show wrong cell height ias all of them has same size, until…
BorjaCin
  • 172
  • 1
  • 1
  • 7
0
votes
2 answers

Image not getting Proper height inside UITableViewCell ios Swift 4

I am trying to download image from server and want to load images inside my cell but as i am downloading inside cellForRowAt method it wont get height for the first time. If i scroll up and scroll down again the image will have proper height. Using…
0
votes
3 answers

UIlabel and UIView height calculation inside self resizing UITableViewCell

I have a UITableViewCell which is used as self resizing tableViewCell. It has one UILabel, one UIView and one UIButton inside it. All of them are put vertically inside. I want UILabel and UIView to be resized automatically when needed. They are…
Ashik
  • 1,204
  • 12
  • 22
0
votes
3 answers

Resizing UITableViewCell after loading image

I am using dynamic height for tableview cells and Haneke for downloading and caching image using the following code: override func viewDidLoad() { super.viewDidLoad() myTableView.rowHeight = UITableViewAutomaticDimension …
UIBittu
  • 215
  • 2
  • 13
0
votes
2 answers

Dynamic height on a static cell with containerView embedded

I want to achieve a desire behaviour using autolayout (or if this is not possible using a delegate or something). What I have is a tableView with one static cell, this cell has a containerView that have a tableViewController with dynamic prototype…
neteot
  • 933
  • 1
  • 12
  • 33
0
votes
1 answer

How to structure complicated table elements

Normally tables are easy to manage , especially since autolayout can do most of the heavy lifting to determine cell sizes and so on. However, there are cases where things become a little bit more tricky like having a table of polls. A poll in this…
Return-1
  • 2,329
  • 3
  • 21
  • 56
0
votes
3 answers

Dynamically adjust height of UITableViewCell fail in Swift 3

I have a customized UITableViewCell,and I want it to update height accroding my label text content. But I try to use this code in my ViewController ViewDidLoad: tableView.register(ChatRightTextTableViewCell.self, forCellReuseIdentifier:…
0
votes
1 answer

iOS8 How dynamically fixed UITableViewHeaderFooterView height size?

I use the method as follows I have just tried below lines of code, dynamically set the UITableViewHeaderFooterView height size. self.tableView.estimatedSectionHeaderHeight = 100 self.tableView.sectionHeaderHeight = UITableViewAutomaticDimension I…
0
votes
2 answers

Autolayout: Can't figure out how to resolve warnings relating to expanding a panel inside a UITableViewCell

I have the following layout for UITableViewCell: The layout consists of two subviews: TopView (containing a Show button) BottomView (which is expanded or collapsed when the Show button is pressed). BottomView consists of 3 subviews. The…
W.K.S
  • 9,787
  • 15
  • 75
  • 122
0
votes
2 answers

TableView Cell Dynamic Height

I have a UITableView(Table 1). Inside UITableView Cell I have an another UITableView(Table 2). In Table 2 the rows's height is UITableViewAutomaticDimension. My requirement is - I want that Table 2 should not be scroll and takes its full height as…
Amanpreet
  • 1,301
  • 3
  • 12
  • 29
0
votes
1 answer

Animation glitch when adding rows and UITableViewHeaderFooterView height is UITableViewAutomaticDimension

I am experiencing some animation glitches when insert new rows in a section and height for header is set to be UITableViewAutomaticDimension with an estimated height. Also, as you may notice, when deleting the rows the headers are jumping directly…
0
votes
2 answers

iOS UITableViewCell with asynchronously fetched image of dynamic size

I'm trying to make table view with two labels and an image in the middle. The image is fetched asynchronously from the web, and after it is fetched I want to make the UIImageView's frame to fit the size of the image, and fit the table view's width.…
0
votes
3 answers

Table View Cell not showing if string assigned to a property is too long

I am building an app that lets the user create a "Story" which consists of a title and a text. I am implementing a tableView that shows all created stories. So far everything works. But here is my issue: When the user enters a title or text that is…
Marmelador
  • 947
  • 7
  • 27
0
votes
1 answer

How to reload only visible (last) cells of a UITableView?

I am building a chat application. I use UTableView to construct chat box. When I load chat box screen, I need to scroll tableview to the index path of last unread message. I am using scrollToRowAtIndexPath method to do so. In this case,…
Advaith
  • 1,087
  • 3
  • 12
  • 31
0
votes
1 answer

UITableViewAutomaticDimension not correctly sizing UIIImageView

I am trying to set the UITableViewCell height based on what is in the cell (Primarily the image). It looks fine on an iPhone 7 Plus, however any smaller devices produce something similar to this. My code in MainViewController: func tableView(_…
gabe
  • 97
  • 2
  • 12