• 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: Markus Spoettl <email@hidden>
  • Date: Mon, 05 May 2014 18:50:20 +0200

On 5/5/14, 6:27 PM, Pax wrote:
I believe that this should cause "IMAGE HERE" to be inserted at specific line
endings.  However, it often inserts into the middle of a paragraph instead -
usually, but not always, close to where it should put the text.  Furthermore,
the positioning is usually at, or very close, to the correct location for the
first instance of image insertion - and it gets progressively less accurate
as it gets through the text.  Is there some difference between the ways that
strings are handled in NSAttributedString and NSString?  Could there be some
problem with characters like Non-Breaking Space?

You should probably reverse the order in which you insert strings/images/stuff. Whenever you insert something, the insert locations that follow this location calculated before inserting a new item will move backwards.

A simple way to get around this is to reverse the insert order, starting at the last index and moving towards 0.

Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

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: Re: Differences in string handling for NSString and NSAttributedString
  • Index(es):
    • Date
    • Thread