Skip navigation.
 
mlmulti coloured string
FROM : Erfan Aleemullah
DATE : Wed Nov 07 22:37:10 2007

Hi all,
I have an issue with NSAttributedString -

I am currently combining several strings into one string using
-stringByAppendingString- and then converting this string into
AttributedString for output -

but each String has a distinct colour (user defined) which the
NSAttributedString object does not recognize - it just colours the whole
concatenated string the same colour based on the value it grabs from
NSDictionary

What is the best way to output a concatenated, multicolored string ?


*Sample Code:*


NSMutableDictionary *dictionary = [NSMutableDictionary alloc];


function for user defined color on string - accepts NSString *temp

{

...

...

...

[dictionary setObject:[some color] forKey:NSForegroundColorAttributeName];

[dictionary setObject:[some color] forKey:NSBackgroundColorAttributeName];

}



temp = [temp stringByAppendingString:newLine];


attributesLine = [[NSAttributedString alloc] initWithString:temp
attributes:dictionary];

Related mailsAuthorDate
mlmulti coloured string Erfan Aleemullah Nov 7, 22:37
mlRe: multi coloured string Shawn Erickson Nov 7, 22:52
mlRe: multi coloured string I. Savant Nov 7, 22:53
mlRe: multi coloured string Shawn Erickson Nov 7, 22:55