• 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: Cocoa Text System - Temporarily Disabling Layout
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Text System - Temporarily Disabling Layout


  • Subject: Re: Cocoa Text System - Temporarily Disabling Layout
  • From: Martin Wierschin <email@hidden>
  • Date: Thu, 23 Sep 2010 14:46:41 -0700

The problem I've had to continuously hack around is that NSTextView, in conjunction with NSLayoutManager, is rather eager to get the text to re-layout.

Maybe, to disable layout, set the textview's textContainer to nil, then restore it to enable layout?

That's one idea, though I wouldn't be surprised if other things go weird as a result.


Personally I'd try to work with the text system in a way it expects. For example:

when I resize the window and need to adjust the frames of both scroll views, calling -[NSTextView setFrame:] results in the layout manager invalidating and ensuring layout for the newly visible character range.

Why not just turn off text view width/height tracking for the container during the resize? That should let the layout manager use the existing layout information (ie: for the stale container size).


The other "state change" you explicitly touch upon is editing the text. If you bracket all your changes to the text storage with begin/ end editing calls, you shouldn't trigger layout until all your changes are finished (unless you're also inadvertently triggering layout in other ways).

Are there any other scenarios where you trigger layout before you're ready?

~Martin

_______________________________________________

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: Cocoa Text System - Temporarily Disabling Layout
      • From: Jonathan Dann <email@hidden>
References: 
 >Cocoa Text System - Temporarily Disabling Layout (From: Jonathan Dann <email@hidden>)

  • Prev by Date: To make an application start everytime when another program starts
  • Next by Date: Re: To make an application start everytime when another program starts
  • Previous by thread: Re: Cocoa Text System - Temporarily Disabling Layout
  • Next by thread: Re: Cocoa Text System - Temporarily Disabling Layout
  • Index(es):
    • Date
    • Thread