カスタム UIButton のタイトルに下線を追加しようとしていますが、ここにある例に従って、画面に表示できません。
これが私が使用しようとしているコードです:
NSMutableAttributedString *commentString = [[NSMutableAttributedString alloc] initWithString:@"The Quick Brown Fox"];
[commentString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [commentString length])];
[button setAttributedTitle:commentString forState:UIControlStateNormal];
これは表示されません。しかし、私が通常のことをするだけなら、次のようになります:
[button setTitle:@"The Quick Brown Fox" forState:UIControlStateNormal];
これはうまく表示されます。誰かが私に欠けているものを教えてもらえますか?