Re: More CALayer Questions
Re: More CALayer Questions
- Subject: Re: More CALayer Questions
- From: Gordon Apple <email@hidden>
- Date: Mon, 07 Jul 2008 19:49:11 -0500
Thanks. That's a good suggestion. I just realized that the thing was
trying to animate and was interfering with my attempts to manually draw. I
saw "removeAllAnimations" and tried it to solved my immediate problem. I'll
see if I can use what you mentioned instead. I'm not currently using
CALayers for animation (yes, eventually), but just wanted a layering system
that will hopefully let me to stack drawing layers, annotation, etc. along
with live video layers and other things.
> Hi Gordon,
>
> I'm not sure what you really want to do is -removeAllAnimations. I
> suspect that you probably want to temporarily disable animation within
> the scope of a CATransaction. Take a look at the code found here:
>
> <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide
> /Articles/Transactions.html#//apple_ref/doc/uid/TP40006096-SW9
>>
>
> later,
>
> douglas
The view is a main presentation view that is (optionally) in a scroll
view. I started out using the clipView, a la the Sketch example. Then at
someone else's suggestion I switched to scaling my main view instead.
Either way works great for a non-layer-backed view. The popup in the scroll
bar ranges from 10% to 1600%.
Currently, I'm just changing the view's frame and then resetting the
bounds to the original size. I also tried "scaleUnitSquareToSize". It
worked, but produced no different result with CALayers. I will also need to
be able to change the bounds when the user changes the presentation
dimmensions, e.g., 640 x 480 to/from 1024 x 786. All that worked until I
tried CALayers.
If I could figure out what changing the scroller size does, maybe I
could make it do the same thing to adjust properly when the user changes the
scale.
> What exactly are you doing to scale your views? layers?
>
> When scaling layers within a non-scrolling view, I have used the
> following method:
>
> [targetLayer setValue: [NSNumber numverWithFloat: newScaleValue]
> forKeyPath: @"scale"];
>
> Usually, I place a statement like this in an action method that is
> targetted by a slider and it produces no-brainer results
>
> When I needed to scale a layer hosted by a view that was enclosed in a
> NSScrollview, i used the following method:
>
> clipView = [targetScrollView contentView];
> ` newBoundsSize = NSMakeSize( NSWidth( [clipView frame] ) /
> newScaleValue, NSHeight( [clipView frame]) / newScaleValue);
> [clipView setBoundsSize: newBoundsSize];
>
> This works for the most part. The scaling is sluggish and sometimes
> the view doesn't redraw properly until a scroller is movedc.
>
> Have you tried both of these methods? Other methods?
_______________________________________________
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