【发布时间】:2011-04-14 18:31:26
【问题描述】:
我希望在我的视图中添加一个带有透明背景的黑色标签(见下文)
// ADD LABEL
UILabel *label = [[UILabel alloc] init];
[label setFrame:CGRectMake(124, 312, 72, 35)];
[label setText:@"Yay!"];
[label setTextAlignment:UITextAlignmentCenter];
[[self view] addSubview:label];
[label release];
当我添加标签时,它总是出现在白色背景上的黑色文本。我查看了NIB,我能看到的唯一方法是将背景>颜色>不透明度设置为0,或者在Xcode中:
[label setBackgroundColor:[UIColor clearColor]];
这是正确的做法吗?
干杯加里
【问题讨论】:
标签: iphone objective-c cocoa-touch