• 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: Differences in string handling for NSString and NSAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Differences in string handling for NSString and NSAttributedString


  • Subject: Re: Differences in string handling for NSString and NSAttributedString
  • From: Uli Kusterer <email@hidden>
  • Date: Mon, 05 May 2014 18:53:59 +0200

To add an example:

Original\nString\nGoes\nHere
        ^8      ^15   ^20   ^25

Now I insert the first image, say just 1 character:

Original\nAString\nGoes\nHere
        ^8       ^16   ^21   ^26

See how all the insertion offsets would have to change? But since you already have your list of insertion offsets, you'll insert in the wrong spot, and it'll just get worse and worse with each insertion, especially the longer it is.

Backwards is not a problem:

Original\nString\nGoes\nAHere
        ^8      ^15   ^20    ^26

Only the end changes on the first insertion, and on the second:

Original\nString\nAGoes\nAHere
        ^8      ^15    ^21    ^27

Only the end and the (already-completed) last insertion location changes.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de


_______________________________________________

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


References: 
 >Differences in string handling for NSString and NSAttributedString (From: Pax <email@hidden>)

  • Prev by Date: Re: Differences in string handling for NSString and NSAttributedString
  • Next by Date: Re: Differences in string handling for NSString and NSAttributedString
  • Previous by thread: Re: Differences in string handling for NSString and NSAttributedString
  • Next by thread: How to convert a UTF-8 byte offset into an NSString character offset?
  • Index(es):
    • Date
    • Thread