calayer

Can custom transforms be used (in theory) to create a water ripple effect on a CALayer?

It's possible to create custom transform matrices. But I wonder if they are suited for making water ripple effects on a CALAyer. Think of 20 of them in an animation. Can someone tell? ...

Using Core Animation/CALayer for simple layered painting

I would like to create a custom NSView that takes a layered approach to painting. I imagine the majority of the layers would be the same width and height as the backing view. Is it appropriate to use the Core Animation classes like CALayer for this task, even though I don't expect to need much animation? Is there a more appropriate appr...

CALayer drawInContext vs addSublayer

How can I use both of these in the same UIView correctly? I have one custom subclassed CALayer in which I draw a pattern within drawInContext I have a another in which I set an overlay PNG image as the contents. I have a third which is just a background. How do I overlay all 3 of these items? [self.layer addSublayer:bottomLayer]; ...

How to use CAGradientLayer?

I'm getting up to speed with the new APIs introduced in OS 3.0, especially the cool new improvements to Core Animation (mostly on CALayer etc...). Now I'm trying to figure out how to use CAGradientLayer. It looks simple at first, but the NSArray it requires for the colors property must contain CGColorRef (according to the header file). I...

CATiledlayer delegate not getting called

I am trying to use a separate delegate class (as many examples do) to perform the drawing of a large image in a CATiledlayer. The tiled layer has been added as a sub layer in a separate view. I first start out with a view controller. // ImageInTiledLayerViewController.h #import <UIKit/UIKit.h> #import <QuartzCore/QuartzCore.h> #import...

CAShaperLayer -renderInContext Doesn't Work?

I am able to create a UIImage from a Core Animation layer using the following code: - (UIImage*)contentsImage; { UIGraphicsBeginImageContext([self bounds].size); [self renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; }...

key-value-coding a UIView's ivars

I'm interested in running some methods when my UIView is changed, either through a frame change or an affine transformation. My best idea is to do this by observing value changes for: myView.frame and myView.transform. However, the view portion of UIViews is not Key-Value complaint. Fortunatly the model portion of the view, the CAL...

Drawing woes with CALayer.

First of all, im finding the iPhone online docs to be not-so-very thoroughly clear when it comes to the various ways of rendering a layer. I get the jist of it, but im not clear when to use which methods and which requires the layer to be added as a sub layer or not. My project started off trivially with me loading images and simply dra...

How to Rotate a CALayer-backed NSView subclass

I have a custom NSView subclass that I want to animate with Core Animation. I am already (without CA) setting the position and rotation of these views with NSView's setFrameOrigin and setFrameRotation methods. However, no matter what I do, once I add a layer backing to the views I can't get them to rotate. I've tried using NSView's setF...

CALayer explicit animations not behaving properly.

Implicitly things behave fine. But when i try to use explicit animations to do multiple animations on a single layer (e.g. opacity and translation) I get odd results. First of all, i tried using CATransaction. Then i switched to CAAnimationGroup. Both doesnt seem to get what i want. What do I want? All i want is for a layer to move fro...

What could a leaked UIImage of size 16 Bytes indicate?

16 Bytes is pretty small, right? None of the UIImages I create in my app are that small, yet the Leaks Instrument is reporting a leaked UIimage of size 16 Bytes... Any clues on what this could be? Incidentally, there was also a leaked CALayer object of 48 bytes... ...

Disable redrawing of CALayer contents when moved (iphone)

I have a UIView with a large number of CALayers (~1000), each of which has a small image as its contents. This UIView is a subview of a scrollview (actually it's a subview of another view which is a subview of the scrollview). This draws relatively quickly at first (couple seconds). However when I scroll in the scrollview the frame ra...

After rotating a CALayer using CABasicAnimation the layer jumps back to it's unrotated position

I am trying to create a falling coin. The coin image is a CALayer with 2 CABasicAnimations on it - a falling down and a rotation one. When the falling down animation gets to its end, it stays there. The rotation animation though, which is supposed to be random and end up in a different angle every time, just pops back to the original CAL...

How do I update a constraint on my CALayer?

I have a CATextLayer that I want to be able to vertically align within my view. I can set a constraint to align it to the top of the view, to the middle, or to the bottom; but I want to be able to allow the user to change this on the fly. When I set up my CATextLayer, I use this constraint to align it in the middle: [textLayer addCons...

No effect of reordering sublayers

I have a UIView subclass that instantiates three sibling sublayers of its layer. Two of the sublayers have their content set to images files; and the third has a graphic drawn in the - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx method. The problem is that my drawing layer always appears behind the image layers. I...

Is there a cost associated with over using hidden on a CALayer?

Hey Everyone, Was wondering if someone might know the answer to this question - is there a cost associated with over hiding a layer. For example, if a layer is already hidden, does calling layer.hidden = YES over and over have any more overhead than simply stepping through the call stack? Is Cocoa smart enough to know that the layer i...

Should I compose a complex UIView with more UIView's or more CALayer's ?

I have a complex view which is composed of a base image overlaid with other images and 2D paths. I wonder what difference will it make if a assemble the complex view by creating a different UIView for each element and adding them as children of the complex view or if I should instead create a a different CALayer for each element and ad...

Observing animated property changes in a CALayer

I have a CABasicAnimation that animating a property of a CALayer e.g. bounds.origin. I want to be able to observe the property changing over time, but haven't really found a method that works 100%. I tried using KVO (key-value observation) on the presentationLayer's bounds.origin keyPath. The system complains that the object is freed b...

How to display this CALayer in an efficient way?

I have a CALayer object whoose contents property is set to the CGImage property of an UIImage. So the layer contains that image bitmap. How could I make a CALayer like this visible on screen? I want to avoid UIView if possible, since that would undo all performance benefits from a "plain" CALayer. What options are there for this? ...

webview in core animation layer

I wanted to create a webView inside of a CALayer. Maybe it is too trivial but I am just getting my head into CA. Would anyone please be able to help? cheers Ron ...