0

プログラムでボタンを作成し、UIScrollView に追加しています。

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(50, 10, 150, 80);
[button setTitle:@"all" forState:0];
button.titleLabel.font = [UIFont fontWithName:@"Helvetica-Light" size:20];
button.titleLabel.textColor = [UIColor blackColor];
button.layer.backgroundColor = [[UIColor clearColor] CGColor];
[scrolView addSubview:newGuysButon];

スクロール ビューをクリックすると、ボタンの色が黒から白に変わります。どのようにそれが起こることができますか?

4

2 に答える 2

1

– setTitleColor:forState:テキストの色を設定するために使用してください

于 2013-06-25T20:32:32.077 に答える