• 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: scrollRangeToVisible
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scrollRangeToVisible


  • Subject: Re: scrollRangeToVisible
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 11 May 2007 08:30:48 -0700


On May 10, 2007, at 5:24 AM, Gerriet M. Denkmann wrote:

I have a method:

- (void)appendLogText: (NSString *)oneLine ;
{
NSTextStorage *textStorage = [ textView textStorage ];
NSAttributedString *att = [ [ NSAttributedString alloc ] initWithString: oneLine attributes: logAttributes ];
[ textStorage appendAttributedString: att ];
[ att release ];
[ textView scrollRangeToVisible: NSMakeRange( [ textStorage length], 0 ) ];
}


If this method is called a few hundred of times, it becomes incredibly slow.
The reason seems to be that scrollRangeToVisible: does a layout each time it is called.
This is quite unneccessary, as the text view will be displayed only at the end of the current event.


So what I need is obviously something like: (void) justBeforeTheNextDisplayScrollRangeToVisible:(NSRange)aRange

The question has come up before, and I believe I recommended using an NSLayoutManager delegate to detect when layout has completed. There is likely to be some code out there specifically for this purpose; you should look around.


Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >scrollRangeToVisible (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: Hang when Nib is loaded
  • Next by Date: Re: changing the default color for text drawing
  • Previous by thread: Re: scrollRangeToVisible
  • Next by thread: Re: scrollRangeToVisible
  • Index(es):
    • Date
    • Thread