UIFont *keyFont = [UIFont fontWithName:@"Roboto-bold" size:16];
NSDictionary *keyFontDict = [NSDictionary dictionaryWithObject:keyFont forKey:NSFontAttributeName];
NSMutableAttributedString *titleAttrStr = [[NSMutableAttributedString alloc] initWithString:@"" attributes:keyFontDict];
NSString *str = @"ABC";
[titleAttrStr.mutableString setString:str];
上記の属性文字列を設定すると、フォントが適用されません。 私は以下のフォーマットでフォントを取得できます。NSMutableAttributedString文字列をリセットするとその属性が適用されませんか?
NSMutableAttributedString *titleAttrStr = [[NSMutableAttributedString alloc] initWithString:str attributes:keyFontDict];
私は一度だけ&文字列をresetingによってAttributedStringのを使用を作成します。あなたがオブジェクトを作成するときには、現時点では非空の文字列を使用している場合
'replaceCharactersInRange:withString:'を使用しますか? – Larme
'EMPTY_STR 'とは何ですか? –
その空の文字列が更新されました – balusu