タイトルとして NSMutableAttributedString を持つ UIButton クラスがあります (書式設定用)。「選択」されているため、ボタン テキストの titleColor を vc クラスから変更したいと思います。
通常のボタンタイトルとしては問題ありません。しかし、NSMutableAttributedString として - サイコロはありません。
いくつかの質問/アドバイス: カスタム クラス ビューは既にボタンになっているため、VC からではなく、そのクラスで色の更新を行う必要がありますか? カスタムクラスで色を更新してベイクするように指示するだけですか?
VC からアクセスして色を変更できるように、ボタンのタイトルの NSMutableAttributedString プロパティを公開しますか? このようにして、新しいテキストと新しい色を渡すこともできます。
私のCircleButton mファイルで
NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[style setAlignment:NSTextAlignmentCenter];
[style setLineBreakMode:NSLineBreakByWordWrapping];
UIFont *font1 = [UIFont fontWithName:@"Futura" size:20.0f];
NSDictionary *dict1 = @{NSUnderlineStyleAttributeName:@(NSUnderlineStyleNone),
NSFontAttributeName:font1,
NSForegroundColorAttributeName:textClr,
NSParagraphStyleAttributeName:style};
attributedTText = [[NSAttributedString alloc] initWithString:btnTxt attributes:dict1];
[[button titleLabel] setNumberOfLines:0];
[[button titleLabel] setLineBreakMode:NSLineBreakByWordWrapping];
[button setAttributedTitle:attributedTText forState:UIControlStateNormal];
[button setTitleColor:textClr forState:UIControlStateNormal];