• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: multi coloured string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multi coloured string


  • Subject: Re: multi coloured string
  • From: "Shawn Erickson" <email@hidden>
  • Date: Wed, 7 Nov 2007 13:52:48 -0800

On 11/7/07, Erfan Aleemullah <email@hidden> wrote:
> 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 ?

Simple create an attributed string with each string range colored as needed...

Your example code appends strings together and then creates an
attributed string with what looks to be the last color specified,
which is not what I think you want.

Why not use NSMutableAttributed string? You would then create an
NSAttributed string for each string with the color information for
that string. Once you have that attributed string append it to your
mutable attributed string.

-Shawn
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: multi coloured string
      • From: "Shawn Erickson" <email@hidden>
References: 
 >multi coloured string (From: "Erfan Aleemullah" <email@hidden>)

  • Prev by Date: multi coloured string
  • Next by Date: Re: multi coloured string
  • Previous by thread: multi coloured string
  • Next by thread: Re: multi coloured string
  • Index(es):
    • Date
    • Thread