core-animation

Can`t draw in CAlayer.

HI All. I have subclass of UIScrollView. IN this class I have added some imageView.layer to self.layer. And when I call [imageView.layer setNeedsDisplay] my implemented delegate never called. -(void)drawLayer:(CALayer*)layer :(CGContextRef)context I`ve also set imageView.layer.delegate = self Could anyone tell me where I must s...

Core Animation not working on Leopard, working on Snow Leopard

Hi, I animate NSImageViews using its animator proxy. While testing my application on Snow Leopard, everything works as expected. However, on Leopard, none of the animations are functioning. In addition, NSImageViews don't seem to take into effect the alphaValue I set on them, whether through the animator proxy or not. The only way I...

iPhone hitTest broken after rotation

Hi all, I have a UIView that contains a number of CALayer subclasses. I am using the following code to detect which layer a touch event corresponds to: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint touchPoint = [touch locationInView:self]; NSLog(@"%@,%@",NSStri...

How to animate the drawing of a CGPath?

I am wondering if there is a way to do this using Core Animation. Specifically, I am adding a sub-layer to a layer-backed custom NSView and setting its delegate to another custom NSView. That class's drawInRect method draws a single CGPath: - (void)drawInRect:(CGRect)rect inContext:(CGContextRef)context { CGContextSaveGState(context...

My presentation layer does not match my model layer even though I have no animations

On iPhone I have a CALayer that I animate via Core Animation. Then at some point I change view controllers. I then return to the view controller with the CALayer and in viewWillAppear: I set the frame and position properties on my layer to move it back to its starting point. Setting these properties changes the model layer but the pre...

presentationLayer position property yielding bad values on iPad, no problem with iPhone

I have a game with several small objects animated using CAKeyframeAnimation. Objects animate perfectly for BOTH iPhone and iPad. However, the value of the position property of the animated CALayers' presentationLayers only yield reasonable values on the iPhone. I use the current position of the animating objects for hit testing. Any ...

Turn a page (a UIWebView) with an animation

Hi, I have a webview, which shows the pages of a ebook. I want to switch from one page to the next page with a page curl animation. By now, I know how to switch the page and how to apply a page curl animation on the webview. But how do I apply the curl animation in a way that it looks like flipping from one page to another? ...

Is Core Animation causing my subviews to call -drawRect for every single frame?

I made a nice UIView subclass which paints all its stuff in -drawRect:, because people said that's good. That view is a subview of another. This another view is beeing animated with Core Animation: It's scaled down, rotated and moved. However, I encountered this: -drawRect seems to get called trillion of times during animation, and perfo...

Render data offscreen in UIView

How would I go about drawing a view offscreen in order to perform some calculation before the view's draw is actually done? Can this be done by drawing to a temporary layer? ...

Why i cannot get the frame of a UIView in order to move it? The view is defined.

I am creating a nav-based app with a view that floats at the bottom of the screen (Alpha .7 most of the time). I create it like this... // stuff to create the tabbar/nav bar. // THIS ALL WORKS... // then add it to subview. [window addSubview:tabBarController.view]; // need this last line to display the window (and tab bar controller)...

CAKeyframeAnimation - Examples

I have a a menu that is a CALayer that will slide across the screen to a given point. I want the effect where the menu will go a little past the point, then a little before the point, and then land on the point. I can move the menu by applying a transform, but I was hoping to get this bouncing effect to work. I was looking into CAKeyf...

Can I use Core Animation without CALayers?

Hello! Is it possible to use Core Animation to change something else than properties of CALayers? I’d like to use a simple property animation with easing to change a value on my model class. Something like this: CABasicAnimation* anim = [CABasicAnimation animation]; anim.keyPath = @"someProperty"; anim.fromValue = [NSNumber numberWithFl...

jerky animation using Core Animation

In my iPhone app, I am trying to get some red and white stripes that are scrolling across the screen to animate smoothly when the speed of the stripes gets high. In my app the user starts the animation and changes the scrolling speed by a finger swipe and changes the width of the stripes by a two finger pinch. Animation is stopped in r...

Handle default animation block when rotate UIViewController

Hi, I have an UIViewController into an navigationController.All I want is when I rotate from landscape into portrait, to change the view into another one which belong to another view controller(another tab from the bottom tab bar controller). I have done this using the following code: -(void) willRotateToInterfaceOrientation:(UIInterf...

Issue with CAAnimation and CALayer Transforms

I have a CALayer that I want to animate across the screen. I have created two methods: one slide open the layer and one to slide close. These both work by assigning a property to the layer's transform property. Now I want to use a CAKeyFrameAnimation to slide open the layer. I got this working so the layer slides open, but now I can'...

Darkening UIView while flipping over using UIViewAnimationTransitionFlipFromRight

I'm using a standard animation block to flip over from one view to another, like this: [UIView beginAnimations:@"FlipAnimation" context:self]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:NO]; [UIView setAnimationBeginsFromCurrentState:NO]; [containerView exchangeSubviewAtIndex:1 withSubv...

[CA_COLOR_OPAQUE] things that make a layer non-opaque. scaled CAGradientLayer?

i spent some time with the environment variable CA_COLOR_OPAQUE = 1 and have my findings to share. things that make a CALayer non-opaque (slow, more memory, ...): * contents with alpha (like an NSImage with an icon) * NSImage/CGImage from a pdf as contents (even when the pdf does not contain any alpha and opaque=YES) * b...

iPhone User Interface Design

Hey guys, I've just had a nagging question for a while regarding iPhone app user interfaces. For example, consider WeightBot's User Interface. I am wondering, how are most of these user interfaces created? In general, of course. Is there a way to simply design controls (that is, the images) in a program like Photoshop, then use that 'sk...

How to animate line-drawing in iPhone development?

I have been searching around, but there seems no good answer for this simple question. So I am asking again: how to animate line-drawing in iphone dev? Basically what I want is something like this: @implementation MyUIView - (void) triggerLineDrawing: (CGPathRef) path { ... // animate line drawing here // and the line should ...

How do I animate the simultaneous rotation and scaling of a view?

I have this view and I do some rotation transformation to it using something like myView.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); //The view was originally at 0 degrees. at some other point of my code, I would like to scale the view animating it, so I do [UIView beginAnimations:nil context:NULL]; [UIView setAni...