String munging in Objective-C with NSAttributedString.
Posted
by dreeves
on Stack Overflow
See other posts from Stack Overflow
or by dreeves
Published on 2008-12-21T22:17:33Z
Indexed on
2010/04/18
20:53 UTC
Read the original article
Hit count: 444
I have an NSAttributedString s and an integer i and I'd like a function that takes s and i and returns a new NSAttributedString that has a (stringified) i prepended to s.
It looks like some combination of -stringWithFormat:, -initWithString:, and -insertAttributedString: would do it but I'm having trouble piecing it together without a lot of convolution and temporary variables.
More generally, pointers to guides on making sense of NSAttributedString and NSMutableAttributedString would be awesome.
© Stack Overflow or respective owner