嗯,我在UILabel中绘制边框时遇到了一些问题。这里是我的代码在UILabel中绘制边框
CGRect frame = CGRectMake(10, 10, 320, 120);
UILabel *label = [[UILabel alloc] initWithFrame:frame];
label.textColor = [UIColor greenColor];
label.font = [UIFont fontWithName:@"Verdana" size:12];
label.textAlignment = UITextAlignmentCenter;
label.text = @"Some text to display";
label.layer.backgroundColor = [UIColor cyanColor].CGColor;
label.layer.borderColor = [UIColor redColor].CGColor;
[self.window addSubview:label];
[label release];label=nil;
我有QuartzCore包括和我使用的iOS4.3当我启动在sumulator文本应用程序显示,但不是边框和背景颜色的片段。 这里有什么问题?
有趣。我正在做一些我不想出现边框的地方。我在标签周围出现一个微弱的边框。我的布局是这样的:两个UILabels放置在背景颜色为白色的UIView中。这个UIView本身就是具有红色背景的较大UIView的子视图。微弱的轮廓显得灰色。 – 2013-01-04 02:08:40