Tag: 彩色

无法更改UILabel文字颜色

我想更改UILabel文本颜色,但是我无法更改颜色,这是我的代码的样子。 UILabel *categoryTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 46, 16)]; categoryTitle.text = @"abc"; categoryTitle.backgroundColor = [UIColor clearColor]; categoryTitle.font = [UIFont systemFontOfSize:12]; categoryTitle.textAlignment = UITextAlignmentCenter; categoryTitle.adjustsFontSizeToFitWidth = YES; categoryTitle.textColor = [UIColor colorWithRed:188 green:149 blue:88 alpha:1.0]; [self.view addSubview:categoryTitle]; [categoryTitle release]; 标签的文字颜色是白色的,不是我的自定义颜色。 感谢任何帮助。

以编程方式创build一个带有颜色渐变的UIView

我试图在运行时生成具有渐变颜色背景(纯色透明)的视图。 有没有办法呢?