Re: Catalina scroll view issues
Re: Catalina scroll view issues
- Subject: Re: Catalina scroll view issues
- From: Allan Odgaard via Cocoa-dev <email@hidden>
- Date: Fri, 03 Jan 2020 10:11:18 +0700
On 1 Jan 2020, at 2:46, Rob Petrovec via Cocoa-dev wrote:
drawRect is not deprecated. Correct. However, it is technically old
fashioned. It is much more efficient to use layers. Layers can take
better advantage of the video card especially during animations, and
don’t require unnecessary redraws if (part of) your view is covered
up and then uncovered (e.g. during scrolling or windows moving around
etc).
In itself it is not “much more efficient to use layers”.
Only if you change layer properties for animation effects do you save on
redraws, but it comes at the cost of extra memory consumption.
As for redrawing windows, these are already drawn into off-screen
buffers and clip views maintain some overdraw rectangles to make
scrolling smoother. So you normally don’t reduce redraws by using
layers.
Also, the layer equivalent of a scroll view is CATiledLayer, this has
different behavior in that it redraws tiles in a background thread and
then uses transitions to make them appear. But it also uses transitions
when you change properties which I found problematic, for example
resizing the document view because of changed content would re-use
existing tile and just scale it, before transitioning to the new tile
(being drawn in a background thread).
For some types of applications, this behavior is fine, but probably not
for a text editor like OP is writing, and at least I was unable to find
a way to just do atomic updates without the transition stuff (I did try
CATransaction).
_______________________________________________
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