Wrong UITableViewAutomaticDimension height, only on iPhone 5

uitableviewautomaticdimension swift 5
uitableviewautomaticdimension swift 4
self-sizing table view cells
uitableview dynamic cell height programmatically swift 4
uitableview dynamic height swift
uitableviewautomaticdimension minimum height
uitableview intrinsiccontentsize

The height of my tableview cell is calculated automatically

tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = UITableViewAutomaticDimension

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
     return UITableViewAutomaticDimension

and it works great on all devices, except iPhone 5. Tried this on actual device and in simulator with same result:

Any ideas why is it happening? iOS 10.3.1

tableView.estimatedRowHeight = UITableViewAutomaticDimension is only available on iOS 11.

Use a real value instead :

if #available(iOS 11.0, *) {
    tableView.estimatedRowHeight = UITableViewAutomaticDimension
} else {
    tableView.estimatedRowHeight = 200

Wrong UITableViewAutomaticDimension height, only on iPhone 5, The height of my tableview cell is calculated automatically tableView.rowHeight = UITableViewAutomaticDimension tableView. In iOS8 it works as expected and the cell's height is adapted so that the image appears with the correct width and height. But in iOS9 the cell's height stays constant and the image is shrinked to the cell's height. I could not find any answer in the web. Is the described behavior a bug in iOS 9 or do i do something wrong?

The estimated row height should be the average height of your cells'.

Wrong value from UITableView:rowHeight at iOS8, Apple changed the default row height in iOS8 to UITableViewAutomaticDimension , which is declared as -1 . This means that your table view is  1 Wrong UITableViewAutomaticDimension height, only on iPhone 5 Aug 7 '18 1 This iPhone … is running iOS 11.4.1 (15G77), which may not be supported by this version of Xcode Aug 7 '18 0 Change BG color of a view with tap recogniser Jun 9 '17

You have to set value for estimated row height that will be your minimum rowHeight. Below is an example...

tableView.estimatedRowHeight = 44;

Auto Layout Guide: Working with Self-Sizing Table View Cells, In iOS, you can use Auto Layout to define the height of a table view cell table view's rowHeight property to UITableViewAutomaticDimension . The iPhone 5 supports retina images just like the iPhone 4 & 4s. There are a variety of methods for adding these images, but the basic concept is to create an image at 2x the size you’d like it displayed and then tell the browser to display it at half of that size.

Incorrect height when using auto size UITableViewCell · Issue #88 , So UITableViewCell detect TagListView's height as wrong. After scroll out @​HarukaMa I only test in iOS 10, create this issue just wanna know if there is a official solution. Thanks for tableView.rowHeight = UITableViewAutomaticDimension or tableView. +1 5 -1 1. @ksathireddy. Copy link. Quote reply  That means if you have an iPhone 5 or an iPhone 5C, your expensive slab of aluminium and glass is about to become obsolete. (See the update below: you iPhone 5 might survive just a little longer.)

No auto layout on first load tablewview · Issue #10 · smileyborg , I create a TableViewController with dynamic height on the cells. work with the new cells, only I have a problem with the first 10 cells that appears without scrolling If you're having row height issues on iOS 8.0 or 8.1, where your cells are sized incorrectly smileyborg mentioned this issue on Apr 5, 2015. The display has rounded corners that follow a beautiful curved design, and these corners are within a standard rectangle. When measured as a standard rectangular shape, the screen is 5.85 inches (iPhone 11 Pro), 6.46 inches (iPhone 11 Pro Max), or 6.06 inches (iPhone 11, iPhone X R) diagonally. Actual viewable area is less.

UITableView: Automatic Row Height, Instead, you can use automatic row height. Hint: This post is using Swift 3, Xcode 8 and iOS 10. Video  The next two steps demonstrate using the iSclack, a great tool for safely opening the iPhone 5 that we recommend for anyone doing more than one repair. If you aren't using the iSclack, skip to Step 6.

  • check your constraints.
  • try tableView.estimatedRowHeight = 10
  • i agree with @MaheshDangar
  • @TmGoyani >it works great on all devices, except iPhone 5. How can constraints be the reason?
  • @Edward if you want to achieve dynamic height in all devices then you must have set proper constraints and return 'UITableViewAutomaticDimension' in heightForRow.
  • no, it is just a constraints problem not versioning problem cuz UITableViewAutomaticDimension is available after ios 5.0
  • You're talking about setting 'UITableViewAutomaticDimension' in 'rowHeight' not 'estimatedRowHeight'. This is new in iOS11. Please read the answer properly.
  • Thank you, @GaétanZ!