문제

I create a NSMutableAttributedString in the init method of a view by doing this:

self.name = [[NSMutableAttributedString alloc] initWithString:@"Gabe Jacobs"];

How do I update the string within it without initing again? I don't want to have to create a new one every time. Any idea?

도움이 되었습니까?

해결책

NSMutableString *string = [NSMutableString stringWithString:@"first"];
[string replaceCharactersInRange:NSMakeRange(0, string.length) withString:@"second"];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top