What is the default height of UITableViewCell?

前端 未结 8 1420
猫巷女王i
猫巷女王i 2020-12-12 12:21

I thought this information would have been easier to find :-)

What is the default height of a UITableViewCell? It looks like 44 pixels, but I\'d prefer to be sure.

相关标签:
8条回答
  • 2020-12-12 12:41

    On iOS 12 the default height on iPhone X like devices (X, XS, XS Max, XR) is 49pt.

    Other devices on iOS 12 still have 44pt as default. It's a subtle difference, but it feels like a good improvement in direct comparison.

    If you won't believe me, measure for yourself in this screenshot (don't forget to divide by 3)... ;)

    0 讨论(0)
  • 2020-12-12 12:46

    In Swift 4 and Swift 5 simply use:

    UITableView.automaticDimension
    

    Using 44px won't suffice because it will vary with different screen pixel densities.

    0 讨论(0)
提交回复
热议问题