Re: NSView scrolling (NSTextView)
Re: NSView scrolling (NSTextView)
- Subject: Re: NSView scrolling (NSTextView)
- From: Douglas Davidson <email@hidden>
- Date: Mon, 2 May 2005 10:51:21 -0700
On Apr 29, 2005, at 8:26 PM, Anthony Duer wrote: I'm currently using a subclassed NSTextView to do some custom text work. I'm, namely, creating a lot of NSMutableAttributedStrings and highlighting particular words various colors. The text is being read off of a separate socket and passed to the main thread as individual lines via -performSelectorOnMainThread: object: wait:. The object takes that, does some processing, and appends it to the view's text storage. This goes particularly smoothly and it works.
However, I've noticed via Sampler (I'm on 10.2) that what I had thought was slowing things down, namely Glyph generation, isn't the culprit. Rather, it's NSClipView's scrollToPoint: function which is taking up around half of the sampled calls. I'm able to view this directly as scrolling up in the view and keeping it there (I've subclassed so that it doesn't snap to the bottom when receiving new text) causes things to go much faster. Namely, a process that takes 7-9 seconds to complete if I'm watching it go by takes 2-3 seconds if I don't watch it and hit 'end' once the scroll bar stops moving (Which is fairly fast and further supports that glyph generation isn't the problem).
A solution that I believe has worked well for some others on this list is to use NSLayoutManager's delegate methods to watch for completion of layout, and to delay scrolling to the end until layout is complete.
Douglas Davidson
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden