calayer

bringSubviewToFront for CALayer

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. ...

composite colors : CALayer and blend mode on iPhone

I'm trying to use core image on the iphone. I'm able to composite my colors using quartz to draw an uiview, but i want to separate each component into CALayer (UIview consume more resources). So i have a white mask i want to use to filter a background bitmap, and i want to try diffrent blending mode. UNfortunately, the layers are only "...

iPhone Layer confusion...

I am trying to do something that should be really simple. I want to add a gradient to one of my views. I can add it to self.view, but not to viewWithGradient. Here is the code: CAGradientLayer *gradient = [CAGradientLayer layer]; UIColor *colorFirst = [UIColor colorWithWhite:0.10 alpha:0.15]; UIColor *colorLast = [UIColor colo...

iphone 2d drawing newbie question

Hi All, I've been programming the iphone for a couple of months now and have 3 apps in the store already. However, I have not done any kind of graphics programming in the platform. Given that I'm planning on starting my 5th app (the 4th is under Apple's review) I wanted to ask for some pointers as to where to get information for this ...

CALayer renderInContext

I use CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity; rotationAndPerspectiveTransform.m34 = 1.0 / -500; It's success, but I use "renderInContext:context" get CGImage from context, I found the image effect is not changed ! How can I get this effect image from CALayer? ...

iPhone layer management - best practice

Louis - Thanks for your input. Here is what I did, and my current issues, which i don't understand. The menus (2) are UIImageViews that respond to touch. Each is it's own class. The 'sprites' as you called them also respond to touch. In the .m where I add the menus and sprites to the layer, I created two container layers, via this code...

Is CALayer insertSublayer: atindex: destructive?

The documentation is not clear on what happens the the layer currently atindex:xy when using insertSublayer:abc.layer atindex:xy. My experimentation has had mixed results. My understanding is index 0 is furthest from the user (all other layers would be above that one). If I call insertSublayer:abc.layer atindex:0, and def.layer is alrea...

Unable to see second animation started from separate animationDidStop

I'm having some problems getting CoreAnimation to perform multiple animations in succession on the iPhone simulator. I have many layers in my application that I animate – these layers are all sublayers of the layer associated with a UIView in my application. After I animate the first sublayer's position (using explicit animation - CAKeyF...

Mixing CAEAGLLayer with other CALayers

I'm trying, unsuccessfully, to combine OpenGL content with other CALayers. In particular, I would like to overlay the OpenGL content above the other layers (with alpha transparency). I run into two problems: My OpenGL rendering is never displayed (even though the OpenGL functions succeeds). The OpenGL rendering is awfully slow (aroun...

CAAnimation duration not being applied

I am applying a CAAnimation to move a toolbar on- and off-screen. When I touch the superview, that fires the following method: - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [UIView beginAnimations:kViewerToggleToolbarAnimation context:nil]; if (self.viewerToolbarView.isVisible) { self.viewerToolbarVi...

How do I get NSTextFields to fully animation using Core Animation with a layer backs NSView

I have a very basic app I'm using for experimenting with Core Animation. NSWindow -ContentView --CustomView ---NSTextField I set the content view to be layer backed in interface builder and create a transform.rotation animation. When I add this to the content view it rotates properly, but the NSTextField also remains painted at the or...

Preload Images in iPhone application?

I have a sequence of images needed to display in a short time (PNG sequence). There are totally 31 PNGs in total, each with file size about 45KB. I have already loaded them with the following codes: imgArray = [[NSMutableArray alloc] init]; for(int i = 0; i <= 30; i++) { NSString * filename = [NSString stringWithFormat:@"img_000%.2d...

iPhone: Resize CALayer sublayers in view

Hi! I have set up a UIView and added a couple of CALayers as sublayers to the view's layer. Is it even possible to resize the sublayers along with the view? When I resize the layer by setting a new frame only the view's layer gets a new size, but not the sublayers. I set the setNeedsDisplayOnBoundsChange to true for the layers as well as...

Combining CALayer in view with toolbar + others

Hey, I've been using CALayer to do all the custom drawing and animations and found it really nice to work with. But when I tried adding a navigation bar to the superview, it comes out as white. I have a superview with a navigation bar and a subview thats used for the calayer drawing. The drawing in the subview does not reach beyond its b...

UIImageView's CALayer's anchorPoint "accessing unknown component of property" error

I'm trying to rotate an image about the bottom right corner. To do this I know I need to set the layer's anchorPoint, but I can't access it. I've included the QuartzCore framework in my project. To simplify the problem as much as possible, I've reduced the method to these three lines, which still throw the error "error: accessing unknown...

Using CALayer Delegate

I have a UIView whose layers will have sublayers. I'd like to assign delegates for each of those sublayers, so the delegate method can tell the layer what to draw. My question is: What should I provide as CALayer's delegate? The documentation says not to use the UIView the layers reside in, as this is reserved for the main CALayer of...

How to draw a native looking statusitem background on a CALayer

Hi. Actually I want to draw the background of a selected NSStatusItem on the CALayer of my custom statusItemView. But since - (void)drawStatusBarBackgroundInRect:(NSRect)rect withHighlight:(BOOL)highlight does not work (?) on layers I've tried it to draw the color with the backgroundColor property. But converting the selectedMenuIte...

CAShapeLayer slowing down interface rotation

Hi, I am trying to move some custom drawing code from a view into a CAShapeLayer, which then get added as a sublayer to the original view's CALayer. This also works well, but when rotating the device, the animation starts to stutter, e.g. you just see the frame in the original orientation and then the final orientation, with at most one...

Fast User Switching Hides CALayer

I have an GUI cocoa application that is automatically started when the computer is woken from sleep. The application runs in multiple users accounts at the same time and is sometime launched in a user account that is not the current user being displayed on screen (i.e. the active console user). This is where the problem arises. I have a...

presentation layer current position

Hi, I am using the UIView animation to move a ball. But in some conditions i want to stop the animation in between. And same time i am accessing the position of the ball. But it doesn't give the exact position but the some point behind the actual position. CALayer *la = (CALayer*)ball.layer; CGPoint pos = [[la presentationLayer] positio...