calayer

How to work with CALayer: Trying to draw a Layer in my Application

Hi Friends , I am trying to add a layer(CALayer/CGLayer) to my application. So i googled for that and tried. When i am trying to create a CALayer using the following code -(void) awakeFromNib{ CALayer *layer =[CALayer layer]; } But it is showing some warning when compiling.[Warning: No +'layer' method found] I add the framework Q...

Can't set cornerRadius AND shadow on layer that has an image view stretched to its bounds?

This is stumping me. I have a UIView (call it "parent"). The bottommost subview of that view is a UIImageView (call it "child"), whose frame occupies the entirety of the "parent" bounds. I want to round the corners on the "parent" view, and set a drop shadow. I do this on the CALayer of "parent" as usual: [[parent layer] setShadowOffse...

How to add CIFilter to CALayer

Hi Friends I am new to core animation , i add some layers to my view and add image to it. Now i want to give blur effect to my layer But i don't know how to make CIFilter and add it. I go through the related questions Question 1 Question2 My code is given below (Shows compilation error) #import < UIKit/UIKit.h > #import < Quartz...

How to Darken an Irregularly Shaped Transparent CALayer on the iPhone?

I'm putting an image into a CALayer that could be irregularly transparent: theCardLayer.front = [CALayer layer]; theCardLayer.front.contents = (id)[cardDrawing CGImage]; In other words, it might be a square filling the layer or it might be an octagon that leaves the corners see-through. I want to sometimes darken this layer, but wi...

CALayer transformation - anchorPoint problem

Hi there, I work on a card flip animation with CoreAnimation. The layer I want to animation is a UIView with UIImageViews as subviews. The animation approach: CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"]; animation.duration=2.0f; animation.repeatCount=1; animation.fromValue = [NSValue valueWithCATr...

UIButton in CALayer

How can I add a UIButton in a CALayer and hookup the touch event? ...

Crash while in CALayer -hitTest:

This issue really has me stumped... I have an iPad project that I use UIPanGestureRecognizer and I am using the following method call within my handlePanGesture: - (AIEnemyUnit *) hitTestForEnemyUnit:(CGPoint)where { CALayer * layer = [self hitTest:where]; while (layer) { if ([layer isKindOfClass:[AIEnemyUnit class]]...

Resizing Problem with a Layer-Hosting NSView

I have a layer-hosting NSView (-isFlipped = YES) with three layer-hosting subviews. The subviews are a header, a content area, and a footer. The header has a disclosure triangle which will collapse the content view and just show the header and footer stuck together. I can accomplish this pretty easily with Core Animation, but there is...

How to get text in a CATextLayer to be clear

I've made a CALayer with an added CATextLayer and the text comes out blurry. In the docs, they talk about "sub-pixel antialiasing", but that doesn't mean much to me. Anyone have a code snippet that makes a CATextLayer with a bit of text that is clear? Here's the text from Apple's documentation: Note: CATextLayer disables sub-pixel an...

Detecting touches for layers within a UIScrollView

I have a UIScrollView which contains any number of thumbnails that should detect the touch event, perform 3D transformation on themselves and call a delegate method. The one problem I am unable to overcome is detecting which sublayer is being tapped. I am setting layer.name to an index count and the subclass of the UIScrollView does get...

CALayer -hitTest: not respecting containsPoint: overload

Back again and have a different question with the same function that I posted before: - (AIEnemyUnit *) hitTestForEnemyUnit:(CGPoint)where { CALayer * layer = [self hitTest:where]; while (layer) { if ([layer isKindOfClass:[AIEnemyUnit class]]) { return (AIEnemyUnit *)layer; } else { layer...

CALayer and Off-Screen Rendering

I have a Paging UIScrollView with a contentSize large enough to hold a number of small UIScrollViews for zooming, The viewForZoomingInScrollView is a viewController that holds a CALayer for drawing a PDF page onto. This allows me to navigate through a PDF much like the ibooks PDF reader. The code that draws the PDF (Tiled Layers) is lo...

Trying to make a card from CALayers that can flip over

I've been trying to develop a CALayer based "CardView" object that has two layers that face away from each other to present the two sides of a card. I've been working with things like the doublesided property of the CALayer and find the results to be confusing. My base class is CALayer and I'm adding two sublayers to it, one with a M_P...

Mixing CGLayers and CALayers

Here's the setup: I have a NSView which is a CALayer-backed view, and contains many CALayers. I have a CALayer for the 'background' of the view, and many small CALayers which are sublayers. Sometimes this view can be very big (as large as 2560x1400), and when it does there is a very noticeable lag in the CALayers. My guess is that Core ...

CALayer memory usage on draw - implicit cache?

Hello everyone. I'm having a peculiar problem with CoreGraphics/CoreAnimation on the iPhone. To better explain how the problem manifests itself, I'll walk you through my current setup and illustrate with code where appropriate. I'm trying to draw a bunch of preloaded images in a UIView's CALayer, but whenever the image displays, the ap...

How to prevent CALayer from implicit animations?

When I set the backgroundColor property of an CALayer instance, the change seems to be slightly animated. But I don't want that in my case. How can I set the backgroundColor without animation? ...

Fast and Lean PDF Viewer - tips and hints?

There has been many Questions recently about drawing PDF's. Yes, you can render PDF's very easily with a UIWebView but this cant give the performance and functionality that you would expect from a good PDF viewer. You can draw a PDF page to a CALayer or to a UIImage. Apple even have sample code to show how draw a large PDF in a Zooma...

iPhone OS 3.2 equivalent of [CALayer contentsScale]?

Hey I'm trying to do the equivalent thing that the iOS 4.0 method CALayer::contentsScale does, which scales the size of the backing bitmap of the layer. Any way to do this in iOS 3.2, probably by setting the frame size and applying a transform? ...

Hierarchy of iOS App UI

I am getting confused reading about CALayers, UIViews and View Controllers. Can someone explain the relationship each of those have to each other (and include anything I might have missed?). I am particularly interested in a View that may have more than one layer. Does that mean the the View Controller has multiple UIViews or that the U...

What am I missing from this implicit animation code for CALayer ?

Hi all, I am trying to get the following code from a book to work. It animates the layer of a UIImageView called the Chicken : [CATransaction setValue:kCAMediaTimingFunctionEaseInEaseOut forKey:kCATransactionAnimationTimingFunction]; [CATransaction setValue:[NSNumber numberWithFloat:1.0] forKey:kCATransactionAnimationDuration]; theChic...