Questions tagged [calayer]

CALayer is a Core Animation class in the Quartz Core framework. It encapsulates the geometry and presentation of a layer. It supports animations of the layer's geometry and its content.

The layer classes are the foundation of Core Animation and provide an abstraction that should be familiar to developers who have used NSView or UIView. Basic layer functionality is provided by the CALayer class, which is the parent class for all types of Core Animation layers.

The CALayer class is the model class for layer-tree objects. It encapsulates the position, size, and transform of a layer, which defines its coordinate system. It also encapsulates the duration and pacing of a layer and its animations by adopting the CAMediaTiming protocol, which defines a layer’s time space.

2853 questions
450
votes
35 answers

UIView with rounded corners and drop shadow?

I’ve been working on an application for a couple of years and received a simple design request: Round the corners on a UIView and add a drop shadow.To do as given below. I want a custom UIView... : I just wanted a blank white view with rounded…
Aditya Vaidyam
  • 6,259
  • 3
  • 24
  • 26
378
votes
3 answers

Fast and Lean PDF Viewer for iPhone / iPad / iOS - 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…
Luke Mcneice
  • 3,012
  • 4
  • 38
  • 50
201
votes
4 answers

How do I apply a perspective transform to a UIView?

I'm looking to perform a perspective transform on a UIView (such as seen in coverflow) Does anyonew know if this is possible? I've investigated using CALayer and have run through all the pragmatic programmer Core Animation podcasts, but I'm still…
Nick Cartwright
  • 8,334
  • 15
  • 45
  • 56
167
votes
12 answers

How do I adjust the anchor point of a CALayer, when Auto Layout is being used?

Note: Things have moved on since this question was asked; see here for a good recent overview. Before auto layout, you could change the anchor point of a view's layer without moving the view by storing the frame, setting the anchor point, and…
jrturton
  • 118,105
  • 32
  • 252
  • 268
164
votes
15 answers

CABasicAnimation resets to initial value after animation completes

I am rotating a CALayer and trying to stop it at its final position after animation is completed. But after animation completes it resets to its initial position. (xcode docs explicitly say that the animation will not update the value of the…
Nilesh Ukey
  • 5,488
  • 3
  • 20
  • 22
143
votes
15 answers

Disabling implicit animations in -[CALayer setNeedsDisplayInRect:]

I've got a layer with some complex drawing code in its -drawInContext: method. I'm trying to minimize the amount of drawing I need to do, so I'm using -setNeedsDisplayInRect: to update just the changed parts. This is working splendidly. However,…
Ben Gottlieb
  • 85,404
  • 22
  • 176
  • 172
125
votes
14 answers

Rounded UIView using CALayers - only some corners - How?

In my application - there are four buttons named as follows: Top - left Bottom - left Top - right Bottom - right Above the buttons there is an image view (or a UIView). Now, suppose a user taps on - top - left button. Above image / view should be…
sagarkothari
  • 24,520
  • 50
  • 165
  • 235
121
votes
5 answers

CALayer with transparent hole in it

I have a simple view (left side of the picture) and i need to create some kind of overlay (right side of the picture) to this view. This overlay should have some opacity, so the view bellow it is still partly visible. Most importantly this overlay…
animal_chin
  • 6,610
  • 9
  • 37
  • 41
118
votes
1 answer

What does "Receiver type 'CALayer' for instance message is a forward declaration" mean here?

I'm porting a block of code from an iOS4 project to iOS5 and I'm having some troubles with ARC. The code generates a PDF from a screen capture. PDF Generation Code UIView *captureView; ... NSMutableData *pdfData = [NSMutableData…
111
votes
6 answers

What are the differences between a UIView and a CALayer?

Both have most of the same attributes, both support different kind of animations, both represent different data. What are the differences between a UIView and a CALayer?
Oleg Danu
  • 4,149
  • 4
  • 29
  • 47
110
votes
8 answers

CALayers didn't get resized on its UIView's bounds change. Why?

I have a UIView which has about 8 different CALayer sublayers added to its layer. If I modify the view's bounds (animated), then the view itself shrinks (I checked it with a backgroundColor), but the sublayers' size remains unchanged. How to solve…
Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
99
votes
7 answers

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…
Steve
  • 6,332
  • 11
  • 41
  • 53
94
votes
7 answers

iOS White to Transparent Gradient Layer is Gray

I have a CAGradientLayer inserted to the bottom of this small detail view that pops up at the bottom of the app. As you can see, I've set the colors from white to clear, but there's this strange gray tint that is showing up. Any ideas? // Set up…
Eric Gao
  • 3,502
  • 2
  • 19
  • 29
92
votes
17 answers

Inner shadow effect on UIView layer?

I have the following CALayer: CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = CGRectMake(8, 57, 296, 30); gradient.cornerRadius = 3.0f; gradient.colors = [NSArray arrayWithObjects:(id)[RGB(130, 0, 140) CGColor], (id)[RGB(108,…
runmad
  • 14,846
  • 9
  • 99
  • 140
86
votes
6 answers

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 =…
jchatard
  • 1,881
  • 2
  • 20
  • 25
1
2 3
99 100