How can I remove UILabel's gray border on the right side?

北城余情 提交于 2019-12-04 22:52:21

I know this is an old question but I have just come across this exact same problem, so I thought I could help someone else looking.

For me the problem was that I had floating numbers in my frames. The following fixed it for me:

CGRectIntegral( myLabel.frame )

I don't know the reason, but the solution is to get rid of that gray edge to set the background color of the cell to clearColor.

label.backgroundColor = [UIColor clearColor];

First of all, you need to set:

[label setBackgroundColor:[UIColor clearColor]];

Next, set color that you want:

[label layer] setBackgroundColor:[UIColor redColor].CGColor];

This is still happening on iOS 12.

Swift version of Ad Taylor answer:

myLabel.frame.integral

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!