UIButton タイトルテキストの色 質問する

UIButton タイトルテキストの色 質問する

テキストの色を設定していますUIButton

headingButton.titleLabel.textColor = [UIColor colorWithRed:36/255.0 
                                                     green:71/255.0 
                                                      blue:113/255.0 
                                                     alpha:1.0];

別のコードで使用している同じコードの色は変更されませんが、動作しています。

ベストアンサー1

使用

オブジェクティブC

[headingButton setTitleColor:[UIColor colorWithRed:36/255.0 green:71/255.0 blue:113/255.0 alpha:1.0] forState:UIControlStateNormal];

迅速

headingButton.setTitleColor(.black, for: .normal)

おすすめ記事