2
ユーザーが私のテキストファイルに入力するとき、私は新しい文字が以前の属性を継承したい。目的C - NSAttributedString属性を拡張しますか?
私は現在、前の文字から属性を取得し、それを新しい範囲の新しい属性として追加しますか?代わりに以前のattributedStringを拡張するようにする方法はありますか?
// What I have
"a"{attribute1 (0,1)} "b"{attribute2 (1,1)} "c"{attribute3(2,1)}
// What I'm trying to do
"abc" {attribute1 (0,3)}
注:これは、すべての文字のために起こることがある、そのユーザーの種類、ユーザーが前の属性を継承しなければならない新しい文字を入力するようになっています。
EDIT: 詳細情報
// So I create a new AttributedString, added it to my mutable string
NSAttributedString *newString = [[NSAttributedString alloc] initWithString:USER_INPUT attributes:self.defaultAttributes];
[_mutableAttributedString insertAttributedString:newString atIndex:selectedNSRange.location];
// Is it possible to add the USER_INPUT to the end of my mutable attributedString and extends the range of the previous attribute?
-1?かなり不公平に思える – dreamlax