嗯,我在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