Blurry UILabel as programmatic subview of UITableViewCell contentView

后端 未结 9 819
离开以前
离开以前 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:48

    I ran into this problem myself today, and read somewhere that non-integer values for the origin and size of the UILabel's frame can cause this (I know they're floats, but you know what I mean). There has got to be a more elegant solution, but this quick hack appears to have solved the problem for me:

    self.valueLabel.frame = CGRectMake((int) frame.origin.x, (int) frame.origin.y, (int) frame.size.width, (int) frame.size.height);
    

    If you find a better solution, please let me know, I'd love to replace this hack with something a bit more tasteful.

提交回复
热议问题