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
1
vote
2 answers

UIView layer's sublayers display differently/randomly each time view appears

I have a simple custom CALayer to create an overlaying gradient effect on my UIView. Here is the code: class GradientLayer: CALayer { var locations: [CGFloat]? var origin: CGPoint? var radius: CGFloat? var color: CGColor? convenience init(view:…
Aaron
  • 6,466
  • 7
  • 37
  • 75
1
vote
1 answer

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…
dphil
  • 88
  • 3
  • 8
1
vote
0 answers

How to make a custom semi-circular progress indicator with terminator?

I'd like to make a custom semi-circular inverted progress indicator that looks like this: I've tried with CAShapeLayer for background, progress line and progress line terminator (small white circle). I'm using ring.strokeEnd = progress to define…
Andrej
  • 7,266
  • 4
  • 38
  • 57
1
vote
0 answers

How to correctly add a new layer to view in a UIScrollView?

I have an UIImageView in a UIScrollView and the UIScrollView's zoomScale is 1.5. When I add a new layer to the UIImageView's layer. I want to make the new layer's frame equal to the UIImageView's frame. So I write: newLayer.frame = self.bounds Here…
LinShiwei
  • 1,042
  • 14
  • 17
1
vote
1 answer

Fade out CABasicAnimation

I am using a CABasicAnimation that scales a CALayer repeatedly up and down. This means the animation is autoreversing, repeats infinity times, and it's key path is transform.scale. What I want to do is "fade out" the animation at a certain point. So…
return true
  • 7,839
  • 2
  • 19
  • 35
1
vote
1 answer

Swift : Animate CALayer Transform

I have a CALayer circle that I would like to animate the transform. I want it to start off at 0 and then slowly get larger to its original size. Here is what I have: expandingCircleLayer = CAShapeLayer() let radius: CGFloat =…
OriginalAlchemist
  • 391
  • 1
  • 7
  • 28
1
vote
2 answers

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…
Cal
  • 1,625
  • 4
  • 20
  • 30
1
vote
1 answer

How do I use a different layer for UIView's layer object, like this answer states?

I saw an answer where a user mentioned replacing the CALayer class for a UIView. https://stackoverflow.com/a/17558724/998117 But if I add that property, I get Auto property synthesis will not synthesize property 'layer'; it will be implemented by…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
1
vote
0 answers

How do I make a CALayer added to a UIView rotate toward the bottom when the view controller rotates?

Sample project: http://jmp.sh/3jlZTnS I've got a UIView with an embedded CALayer, that sits on the bottom half of the view. When I rotate to landscape, it changes to the right position, however during the rotation it stays stays in its relative…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
1
vote
2 answers

Endless runner imageview animation (No SpriteKit)

Is there a way to animate an UIImageView from right to left without using CABasicAnimation? I'm having troubles with it and I would like to find another way to do it. The "ground" image its 1200 (width) x 33 (height) and I would like to move it from…
iDec
  • 707
  • 2
  • 8
  • 16
1
vote
0 answers

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…
P i
  • 29,020
  • 36
  • 159
  • 267
1
vote
0 answers

CALayer position contains NaN

I had my app running properly, but on my setting VC I was using a lot of if indexPath.row == aGivenRowNumber{ ...}, I try to refactor it using a switch indexPath.row {...} , but now the app start crashing with this error: 'CALayerInvalidGeometry',…
irkinosor
  • 766
  • 12
  • 26
1
vote
0 answers

Is it possible to mask CALayer that is itself a mask of another layer?

The title has it. CALayer has property mask that is of type CALayer. So I have layer A that I want to mask with layer B. Then I want to mask layer B with layer C. It is surely posible to assign values to properties like that. The question is would…
Rasto
  • 17,204
  • 47
  • 154
  • 245
1
vote
1 answer

Core animation using too much memory after I set contentsScale on custom CALayer

I am using a custom CALayer to draw some UI for a keyboard extension and I am noticing a huge amount of memory usage from CoreAnimation after I add the line self.contentsScale = UIScreen.mainScreen().scale The total memory usage from core animation…
1
vote
1 answer

CALayer cornerRadius + masksToBounds 10.11 glitch?

I have a 30x30 view which is rounded: CALayer * layer = self.layer; layer.backgroundColor = [NSColor redColor].CGColor; layer.cornerRadius = 10.0f; layer.masksToBounds = YES; So far, so good: Then I add a sublayer, like so: CALayer * subLayer =…
PhilipG
  • 113
  • 6