Blurry UILabel as programmatic subview of UITableViewCell contentView

后端 未结 9 825
离开以前
离开以前 2021-02-04 02:26

I am adding a UILabel instance as a subview of my custom UITableViewCell instance\'s contentView.

When I select the cell, the row

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-04 02:55

    Sometimes the reason for the blurriness you have mentioned can be that labels's frame is beyond the cell frame. Even if you see all of your text you have put inside the label on your cell, the actual label size can be bigger than the cell frame.

    To check if that is the reason for the effect you see I would suggest to check/print all the data you have about labels size/location after it is instantiated and than check in the delegate method tableView:heightForRowAtIndexPath: that this fit into the cell height you are returning for the cell. Hope it will help in your case.

提交回复
热议问题