» Home » CALayer » Page 1
iphone : remove CALayer when animation stop, CALayer flash before disappear
by Rida Al Barazi in Mobile Programming

create a simple project in XCode
set view to receive multi-touch events
respond in touchesBegan, create CALayer when detect touch event
make a opacity fade out animation for CALayer
when animation stop, remove CALayer from parent

Expect: CALayer disappear normally

Actual: CALayer flash (blink) before disappear

full source code:

How to convert from the upmost CALayer coordinates to the hit CALayer coordinates?
by SperglordActual in Development Tools & Services

I have a tree of CALayers, and each one has its own tranform and position.

Starting from:

-(void)touchesBeganWithEvent:(NSEvent *)theEvent {
id object=[self.layer hitTest:[self convertPoint:[theEvent locationInWindow]
if ([ object isKindOfClass:[TangramTileLayer class]]) {
[ object displayTouchAt:...]; }

CALayer transforming
by gnirpaz in Programming Languages

I need to rotate a square when the user does a UIRotationGesture.

I have the gesture all set up. The problem is every time the user moves their fingers the square returns to the starting position and then animates to the new position. Rather than move from the previous position to the new position.

i.e if the rotation of the square is 90 degrees and the user continues to

CALayer valueForKey:
by lwl_seu in Mobile Programming

How different is the behavior of CALayer's valueForKey from that of any other ordinary NSObject's?
I have a custom layer which inherits from CALayer, and that has a property named 'angle',
but [myLayer valueForKey: @"angle"] always returns nil while [myLayer angle] returns the right value.
ValueForKey: works as intended with a class inherited from NSObject, but not one from CALay

My CALayer is not appearing
by cubby1223 in Mobile Programming

I'm trying to get CALayer working so I can start practicing some animations tricks that I would like to learn. At the moment I want to scale and move things along the z-axis.

Right now I see nothing when I run this code. I would expect to see a black square. But instead nothing is appearing. The code compiles (obviously) and there are no warnings. Is there something I am missing?

Events in CALayer
by Deledrius in Programming Languages

I am using CALayers animation in my code.
Below is my code

CALayer *backingLayer = [CALayer layer];
backingLayer.contentsGravity = kCAGravityResizeAspect;
// set opaque to improve rendering speed
backingLayer.opaque = YES;
backingLayer.backgroundColor = [UIColor whiteColor].CGColor;
backingLayer.frame = CGRectM
TAGS : Events CALayer

CALayer = Total lag
by Yst in Mobile Programming

So I have a scrollView with like 10 buttons on one side. Always when I scroll to that page, I get lots of bad performance. Then I noticed it was the CALayer that was creating the lag! I've used

button.layer.cornerRadius = 25;
button.layer.clipsToBounds = YES;

When I searched on the internet, I found out that I could use

TAGS : CALayer Total

get x & y & z position for CALayer
by Skurge in Programming Languages

I want to get x,y,z position of CAlayer can i get it directly or i should use transform matrix ?

i know how to set its value

[layer setValue:value forKeyPath:@"transform.translation.z"];
[layer setValue:value forKeyPath:@"transform.translation.x"];
[layer setValue:value forKeyPath:@"transform.translation.y"];

but i don't know how to get

TAGS : position CALayer

How to add a CALayer to an NSView on Mac OS X
by z1ggy in Programming Languages

I'm trying to learn how to use and implement CALayer in a Mac Objective-C application, but I can't seem to probably do the most basic thing - add a new layer and set its background colour/frame size. Can anyone see what is wrong with my code?

CALayer *layer = [CALayer layer];
[layer setFrame:CGRectMake(0, 0, 100, 100)];
[layer setBackgroundColor:CGColorCrea
TAGS : CALayer NSView

bringSubviewToFront for CALayer
by language-agnostic in Mobile Programming

I'm wondering if there is a way to bring layer on top of others layers of view. Something like bringSubviewToFront does for UIView class. I think it can be done with zPosition property of the CALayer but this means I have to check zPosition for all layers and then set proper value.

Thanks in advance.

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .