calayer

Rotating a CALayer 90 degrees?

How do I rotate a CALayer 90 degrees? I need to rotate everything include sublayers and the coordinate system. ...

Animating UIView and its sub layers

I have a subclassed UIView that is comprised of several layers (mostly CAShapeLayers with a few CATextLayers). The problem I have is that if I animate resizing the UIView using an animation block (beginAnimations, commitAnimations) and relayout the sublayers in the overridden layoutSubviews, then the layers are not animated with the UIVi...

CALayer Shadows disappearing during a UIView animation

So I'm currently testing out the UIView animations, and I noticed that the shadows rendered by CALayer (using [view.layer setShadowStuffHere]) disappear at the start of the animation and reappear at the end of the animation. Is there any way I can keep these shadows and have the shadows animate along with the UIView? I tried using shadow...

CALayer causes memory leaks?

Hello, the following code makes my app slower as a snail (it causes a memory leak i think): CALayer *layer = [[CALayer layer] retain]; detailcell.layer.borderColor = [UIColor grayColor].CGColor; detailcell.layer.borderWidth = 2; detailcell.layer.shadowColor = [UIColor blackColor].CGColor; detailcell.layer.shadowOpacity = 1.0; detailce...

make CAlayers using for loop

sorry for the simple question but how do you make a CAlayers using a for loop? I have this now but what is the proper way of doing this? for (int n = 1; n <= 6; n++) { NSString *theCloud = [NSString stringWithFormat:@"cloudImage%d",n]; NSString *theCloudLayer = [NSString stringWithFormat:@"cloudLayer%d",n]; CALayer *theClou...

Displaying CAEAGLLayer in a UIView or CALayer

Hi, Rather new to trying to get OpenGL ES working on the iPhone, but I've created a working demo from an OpenGL template and wanted to add it to another App which is a standard UIViewController App. After searching around it seems that I can't addSubview a CAEAGLLayer to a CALayer aka UIView. How would I go about doing this? Or am I com...

How can I stop CALayers from animating?

Hi all, I've created a bunch of sublayers within my view, populating each one with a graphic, so effectively they are sprites. However, when I call [lineLayer setValue:[NSNumber numberWithFloat:0.5] forKeyPath:@"transform.scale"] it appears to 'tween' to that size instead of just appearing at the new scale. Is there any way of switchin...

Is it possible to use Cocoa Touch gesture recognizers with layers / CALayer objects?

Is it possible to use gesture recognizers with layers? Let's say I want to add several sublayers to my view and implement drag&drop as well as tapping on single element. Is it possible at all ? What is the best pattern? ...

Resizing CATiledLayer's Using Scale Transforms vs. Bounds Manipulation

I've got my layer hosted workspace working so that using CATiledLayers for hundreds of images works nicely when the workspace is zoomed out substantially. All the images use lower resolution representations, and my application is much more responsive when panning and zooming large numbers of images. However, within my application I also...

Preventing CALayer Sublayers From Getting Scaled

I have some CALayers in a layer hosted view. Each of these layers has additional layers to hold (1) a close button, and (2) a resize handle. These additional 'control' layers are added as sublayers to the parent layer. Currently, when I zoom the workspace in which these layers reside, everything scales -- including these control layers....

iPhoneSDK Setting CALayer.transform does not work after animation is finished

I have a CALayer object. In viewDidLoad: I set a transform to it using layer.transform = CATransform3DRotate(CATransform3DIdentity, M_PI/8.0, 0, 0, 1); This works. After loading, I apply a CAKeyframeAnimation to animate the rotation of that layer. It also works and animation finishes correctly. To prevent the layer from removing the ani...

UIImageView is disappearing after CAKeyframeAnimation

I'm trying this code (found in an answer here on SO) in a category on UIView and am using it to peform a "pop" animation on a UIImageView nested inside of a UITableViewCell. - (void)attachPopUpAnimation { CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; CATransform3D scale1 = CATr...

iOS: UIVew & CALayer - 2D vs 3D transforms

in my previous code, I changed the coordinate system in my view's drawRect, so that the rectangle had 0,0 in the centre, 0,1 at the top centre and 1,0 in the centre of the right edge. I.e. a normalised Cartesian system. { // SCALE so that we range from TL(0, 0) - BR(2, -2) CGContextScaleCTM (X, 0.5 * bitmapSize.width, -...

iOS CALayer: Problem creating custom coordinate system

I have a layer that takes the whole iPhone screen. I want to change the coordinate system so that (-1,-1) is in the bottom left, and (1,1) in the top right; for the layer and its sub layers. how do I go about it? This isn't as easy as setting the transform: previously I was overriding my view's drawRect, and accomplished the transf...

Deadlocks: How do you determine if a call may cause unsafe painting off of the main thread for iOS?

Drawing/painting should always be done on the GUI thread otherwise deadlocks can occur!... How do you determine if a call may cause unsafe painting off of the main thread for iOS? The problem is we get stacks like this which are not on the main thread... #19 0x02a788d2 in -[CALayer drawInContext:] #20 0x02a784b0 in backing_callback #2...

Cocoa: How do you make the background of an IKImageBrowserView transparent?

How do you make the background of an IKImageBrowserView transparent? There seems to be no background color option in interface builder. What I've tried: I've never used Core Animation, but I saw IKImageBrowserView has a setBackgroundLayer method, so I tried the following, which had no effect: CALayer* layer = [CALayer layer]; [layer...

CALayer autoresizing on iPhone/iPad: How?

I'm trying to create a UIView subclass ("GradientView") that will fill itself with a gradient of various colors. I've implemented it by adding a CAGradientLayer as a sub-layer of UIView's layer. It looked good, but when the screen was rotated, it didn't resize the gradient layer. Having no luck finding a BOOL property on the layer to to...

Will my app get rejected for using CATRANSITION pageCurl ?

Hello was just wondering if my app will get rejected using the following code: [animation setDuration:1.0]; [animation setTimingFunction:UIViewAnimationCurveEaseInOut]; animation.type = @"pageUnCurl"; animation.fillMode = kCAFillModeForwards; animation.startProgress = 0.78; animation.endProgress = 1. 0; This is us...

Why masksToBounds = YES prevents CALayer shadow?

With the following snippet, I'm adding a drop shadow effect to one my UIView. Which works pretty well. But as soon as I set the view's masksToBounds property to YES. The drop shadow effect isn't rendered any more. self.myView.layer.shadowColor = [[UIColor blackColor] CGColor]; self.myView.layer.shadowOpacity = 1.0; self.myView.layer.sha...

Hiding/Removing/Fading CALayer erasing NSView contents

My situation: I have a single window with a content view (NSView), which has several subviews (plain NSControl subclasses; not important, just for testing) scattered around it. For part of the end effect I am trying to achieve, I want to place a semi-transparent black CALayer overlaying the whole window's content view, and be able to m...