calayer

Overlay layer on photo, and export result at higher resolution than the native display.

I want to take a photo with the device's camera, overlay a CALayer on top of it, and export the photo at the native resolution of the device's camera. The best solution i could come up with so far, was to overlay the CALayer on top of the UIView, and capture the current view state using [CALayer renderInContext:]. However the result of ...

iPhone CALayer's rotation axis

Hi guys, I'm rotating a CALayer on the X axis, but even if it's displaced on the Z axis, it uses the Z = 0 as axis for the rotation? Is there a way of telling it to use the bottom of the plane, as the axis? Thank you! ...

Touch Gesture on a CALayer

I am doing some drawing on a CALayer and want to be able to have the user single tap different parts of the drawing and trigger a response. I tried looking into gesture recognizers, and it seems that they need to be tied to a UIView. Any idea how I can get my desired behavior using CALayers? ...

-[CALayer retain]: message sent to deallocated instance

Hi there! I'm developing an iphone app and when I turn on my NSZombieEnabled I have regularly a crash on error : *** -[CALayer retain]: message sent to deallocated instance 0xe6012e0 It always come when I push or pop a view in my view controller. Sometimes there's this error before : -[UIApplication endIgnoringInteractionEvents] cal...

I don't know why my view is freezing

Hi there! I have a big problem since a few days that I can't solve. First I have a login view controller with this code : @implementation MMConnectionViewController @synthesize login, password, activityIndicator, mainVC; - (BOOL)textFieldShouldReturn:(UITextField *)aTextField { [aTextField resignFirstResponder]; [self performSel...

Releasing modal view content controller causes: CALayer release - message sent to deallocated instance

I'm trying to present a viewcontroller modally: - (IBAction)addReference { ReferenceAddViewController *referenceAddViewController = [[ReferenceAddViewController alloc] initWithNibName:@"ReferenceAddViewController" bundle:nil]; [referenceAddViewController setDelegate:self]; [self presentModalViewController:referenceAddViewC...

Force CALayer's rotation direction?

Hi guys, This one has been driving me nuts... Considering "plane" is a CALayer, I rotate it in the X axis: plane.transform = CATransform3DMakeRotation(180 * M_PI / 180.0f, 1.0f, 0.0f, 0.0f); And this makes it rotate clockwise, which is perfect. Now, at some point in time, I want it to return to 0 degrees, so I use: plane.transform...

Subviews counted in root CALayer's sublayers?

I noticed today, when adding 1 CALayer and 2 subviews to my view, when I run the following code in my UIView instance: [self.layer.sublayers count] This returns 3. Does this mean that a subview is also considered a sublayer? If I only wanted the CALayers that I've drawn in my sublayers call, how would i do that? ...

Animate CALayer hide

I'm trying to hide a CALayer after a few microseconds and I'm using CABasicAnimation to animate the hide. At the moment I'm trying to use [aLayer setHidden:YES]; CABasicAnimation * hideAnimation = [CABasicAnimation animationWithKeyPath:@"hidden"]; [hideAnimation setDuration:aDuration]; [hideAnimation setFromValue:[NSNumber numberWithB...

CALayer, anchorPoint and layer hierarchy

Hi, I try to use the anchorPoint in a layer hierarchy to move a layer with its sublayers. Unfortunately the sublayer did not move together with the root layer. In a custom NSView is set up my layer hierarchy like in the following snippet. CALayer * rootLayer; rootLayer = [[CALayer layer] retain]; rootLayer.position = CGPointMake(...); ...

Clipping a CALayer to arbitrary path

Hi All, Is it possible to clip a CALayer to an arbitrary path? I am aware that I can clip to the superlayer's bounds, but in this case I need to be far more prescriptive. TIA, Adam ...

CALayer moves instantly when trying to animate?

The code below handles a stack of CALayers. Every time a new layer is pushed onto the stack the function is locked, and all existing layers and moved down on the screen to make room for the new layer. Once the last layer is done animating the function is unlocked again so that new layers can be pushed. My problem is that every time this...

Magnifier effect with CALayer s

Hi, I want to implement a magnifier exactly like the one is shown when an UITextView is long pressed. I got the idea from here: http://stackoverflow.com/questions/2030730/iphone-reproduce-the-magnifier-effect/2030846#2030846 But I am working only with CALayers not UIViews, hence I don't have a drawRect method to write in. I wonder whe...

An example of pushing and retrieving of an NSObject's pointer in ObjC from Shared Memory?

I know that there are better ways of sharing objects such as distributed objects but my situation is quite difficult. I'm working on two iPhone apps which are running parallely and need to share an object. That object happens to be a CALayer and it needs to be accessible by both applications. Second application adds its own CALayer to th...

Disable animatable CALayer properties

Hi, I have a CATextLayer as a sublayer for a UITableViewCell's contentView's backing layer. I set the foregroundColor of this layer to [[UIColor blackColor] CGColor]. I also have this: - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; [CATransaction begin]; [CATra...

Anti-aliasing while animating "transform" property on CALayer?

I have a CALayer with a circle drawn to it at its final size. I want to animate the circle in, such that it starts at 1% scale and finishes at 100%. Right now the animation is not very smooth because the edges flicker while it's scaling. At the final size the circle looks right. I'm wondering if there's a way to have anti-aliasing during...

iPhone Deck Game interface

Hello I wrote the code of a card game .. but now it's time todo the graphic and Interface What's the best approach to represent a card ?? a) CALayer b) UIView c) UIButton Which one is best to animate and receive user touches??? What do you recommend?? Thanks in advance ...

Why does this chunk of code breaking up a CGColor cause a Bus Error?

Using this code causes a Bus Error. Can someone point out what is wrong with it? I'm overriding a method from CALayer. - (void) setBackgroundColor:(CGColorRef)c { float *components = (float *)CGColorGetComponents(c); [super setBackgroundColor:[LOLColors colorWithRed:components[0] green:components[1] blue:components[2] alpha:tran...

Making a CALayer and all the things inside it semi-transparent?

How to make a CALayer and all the things inside it semi-transparent? That includes all the things drawn with CoreGraphics and CoreText. layer.opacity = 0.5 ...

Add a sublayer to a CALayer without animation?

How can I add a sublayer to a CALayer without animation? Usually when you add one it "fades in" and when you remove one it "fades out". How to supress the animation? ...