如何删除右侧的UILabel灰色边框? [英] How can I remove UILabel's gray border on the right side?
本文介绍了如何删除右侧的UILabel灰色边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将UILabel添加到自定义单元格的contentView中。我遇到了一个奇怪的副作用。在右边界有一个灰色边缘。我不知道为什么。我刚刚添加了一个普通的UILabel,我什么也没做。
I have added an UILabel to a custom cell's contentView. I met with a strange side effect. On the right border there is a gray edge. I don't know why. I just added an ordinary UILabel, I have done nothing else.
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
label.text = @"value1";
label.textAlignment = UITextAlignmentCenter;
[self.contentView addSubview:label];
- (void)layoutSubviews
{
UILabel *label = [self.contentView.subviews objectAtIndex:i];
label.frame = CGRectMake(…);
}
推荐答案
我不知道原因,但解决方案是摆脱灰色边缘将单元格的背景颜色设置为clearColor。
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];
label.backgroundColor = [UIColor clearColor];
这篇关于如何删除右侧的UILabel灰色边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文