views:

27

answers:

2

I have an ivar which is alloc-inited in the init of an object:

attString = [[NSMutableAttributedString alloc] init];

On a loop, I want to clear the contents of attString and re-use it. How do I do this?

Thanks!

+3  A: 
[[attString mutableString] setString:@""];
KennyTM
A: 
[attString release];
attString = [[NSMutableAttributedString alloc] init];

Kenny's method probably quicker.

coob
Yeah I was trying to avoid release/re-alloc to avoid memory inefficiency :)
Joe