我正在UIButton
根据以下提到的代码块以编程方式创建一个。我需要为按钮的文本分配 RGB 颜色。它不适用。有什么特别的原因吗?
CGRect buttonFrame = CGRectMake(353, y, 607, 30);
UIButton *button = [[UIButton alloc] initWithFrame: buttonFrame];
button.tag = event.eventId;
[button setTitle:event.eventName forState: UIControlStateNormal];
button.titleLabel.font=[UIFont fontWithName:@"arial" size:14];
[button addTarget:self action:@selector(btnSelected:) forControlEvents:UIControlEventTouchUpInside];
[button setTitleColor:[UIColor colorWithRed:10.0 green:20.0 blue:100.0 alpha:1.0] forState: UIControlEventAllEvents];
[self.contentView addSubview:button];
谢谢