dequeued UITableViewCell has incorrect layout until scroll (using autolayout)

后端 未结 2 1337
暗喜
暗喜 2020-12-20 11:31

I have a custom UITableViewCell subclass which has had autolayout constraints applied to it in Interface Builder. The cell contains multiple views, including a

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-20 11:42

    If you name a property on a UITableViewCell subclass textLabel or defaultTextLabel, then IB will ignore the constraints you have specified and override them with default ones, with no warnings issued.

    This is the case even on cells designed in IB with the Custom style, which have no visible textLabel or detailTextLabel properties.

    This also happen if add a property of type UIImageView property on a UITableViewCell subclass and name it imageView.

提交回复
热议问题