• 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
Problems with NSLayout addTextContainer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with NSLayout addTextContainer


  • Subject: Problems with NSLayout addTextContainer
  • From: Steve Sheets <email@hidden>
  • Date: Thu, 31 Oct 2002 00:52:57 -0500

Help!!!

My text program is having errors, when I attempt to reflow the text, but only the second time!

Let me explain. My application displays text in 3 column format on mulitble pages, depending on the length of the text. So I create a text storage and layout objects, then on the fly, create container/text view pairs to add to the layout. Each column is 1/3 of the page wide, and one page long. After I add pair using addTextContainer, I call glyphRangeForBoundingRect to have the text flow into the containers. I receive the didCompleteLayoutForTextContainer method, and keep track of when the text have enough containers/text views so to stop adding new pairs to the layout. Everything works perfectly the first time window is displayed. Then user changes a setting, and the text is reformed. I remove the layout object from text storage, and release it (which releases all the containers/text views). Then I create new layout, and start filling in containers/text views. This is same code I use to fill in first time. On the second pair of containers/text views, when I call addTextContainer to add container to layout, I get the following error:

2002-10-31 00:01:18.374 MyApp[3503] *** NSRunStorage, _NSBlockNumberForIndex(): index (793) beyond array bounds (0)
2002-10-31 00:01:18.420 MyApp[3503] Exception raised during background layout: *** NSRunStorage, _NSBlockNumberForIndex(): index (793) beyond array bounds (0)
2002-10-31 00:01:18.428 MyApp[3503] *** NSRunStorage, _NSBlockNumberForIndex(): index (793) beyond array bounds (0)

The funny thing is this code worked for awhile. As always, I was messing with code to have correct appearance, and something broke! Anyone have any suggestions or comments?

Thanks,

Steve Sheets
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Problems with NSLayout addTextContainer
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: overloading operators
  • Next by Date: RE: Better random screensaver
  • Previous by thread: Re: overloading operators
  • Next by thread: Re: Problems with NSLayout addTextContainer
  • Index(es):
    • Date
    • Thread