属性付きの文字列を作成し、条件付きで取り消し線を適用しています。コードは次のとおりです。
NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];
if (needsStrikeThrough) {
[attributes setValue:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
} else {
[attributes setValue:[NSNumber numberWithInt:NSUnderlineStyleNone] forKey:NSStrikethroughStyleAttributeName];
}
NSAttributedString *attString = [[NSAttributedString alloc] initWithString:participant.firstName attributes:attributes];
NSLog(@"attString= %@", attString);
NSLog(@"[attributes description]= %@", [attributes description]);
コンソールの出力は次のとおりです。
attributedParticipantName= Belinda{
NSStrikethrough = 0;
}
[attributes description]= {
NSStrikethrough = 0;
}
そのため、辞書の説明が属性付き文字列に追加されています。なぜですか?