UITableView auto resizing row constraint breaking mysteriously on iPhone 6Plus

前端 未结 3 966
别那么骄傲
别那么骄傲 2020-12-03 16:49

I have a custom UITableViewCell which has a thumbnail and bunch of text. The row height is configured to be calculated automatically using

tableView.estimat         


        
3条回答
  •  我在风中等你
    2020-12-03 17:42

    0.333 on a 3x scale display (which iPhone 6+ is) is probably connected with the cell separator.

    Note that your constraints don't set up the size of the cell, they set up the size of the contentView. But the cell has to add 2 pixels (= 0.666 points) to the cell height for the cell separator. Autolayout tries to keep view positions on integer boundaries so adding 0.666points to the cell height can result in adding 0.333 to your content height.

    You can avoid the error by setting your table separators to None. Although setting up one of the priorities to 999 (usually the bottom priority) as the other answer has suggested is a good solution in general.

提交回复
热议问题