CABasicAnimation does not animate correctly when I update model layer

I think that it’s easiest to explain what is happening for each of the three locations and then a “conclusion” at the end. I’m also adding some illustrations, showing exactly the behaviour that you are mentioning in your question so that it will be easier to follow for someone who hasn’t tried these three things … Read more

add UIImage in CALayer

This is a general answer for the sake of future viewers. It is based on the question title rather than the details of the original question. How to add a UIImage to a CALayer You can add an image to a view’s layer simply by using its contents property: myView.layer.contents = UIImage(named: “star”)?.cgImage Note that … Read more

Layer-backed NSView rotation and skewed siblings

You’ve written that you tried “setNeedsDisplay”. Are you calling this method from the main thread? In one of my applications nothing happened if I called setNeedsDisplay from another thread. If you want to make sure the display is invalid, then use dispatch like so: dispatch_async(dispatch_get_main_queue(), ^{ [view setNeedsDisplay:YES]; }); Additionally have a look in your … Read more

What’s the difference and compatibility of CGLayer and CALayer?

They are completely different, and not compatible. To be absolutely clear: it is strictly a coincidence that the word “layer” is used in both names; they are completely unrelated. CGLayers are a “special” “high performance” thingy. You could consider them “like bitmaps, but better.” Apple sat down and said “We’re sick of people using bitmaps, … Read more

remove all subLayers from a view

The sublayers property of a CALayer object returns a copy of the array. Setting it no nil does nothing about the sublayers. This however will do: for (CALayer *layer in self.view.layer.sublayers) { [layer removeFromSuperlayer]; } Or, in Swift self.view.layer.sublayers?.forEach { $0.removeFromSuperlayer() }

CALayer: add a border only at one side

I made a right border using this: leftScrollView.clipsToBounds = YES; CALayer *rightBorder = [CALayer layer]; rightBorder.borderColor = [UIColor darkGrayColor].CGColor; rightBorder.borderWidth = 1; rightBorder.frame = CGRectMake(-1, -1, CGRectGetWidth(leftScrollView.frame), CGRectGetHeight(leftScrollView.frame)+2); [leftScrollView.layer addSublayer:rightBorder];

How is the relation between UIView’s clipsToBounds and CALayer’s masksToBounds?

They are different names because UIView and CALayer are different and have different terminology associated with them, but they are functionally equivalent. If you disassemble clipsToBounds you will see it just calls masksToBounds (disassembly from the simulator framework, so x86): -(BOOL)[UIView(Rendering) clipsToBounds] +0 3091938a 55 pushl %ebp +1 3091938b 89e5 movl %esp,%ebp +3 3091938d e800000000 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)