我正在創建一個UIButton
根據下面提到的代碼塊編程。我需要將RGB顏色分配給按鈕的文本。它不適用。任何特定的原因?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];
感謝