core-animation

Customise UINavigationController animation: CATransition

最后都变了- 提交于 2019-12-05 09:19:49
I have an UINavigationController. I made VC1 the rootViewController and programatically load VC2 from VC1 and then have the custom animation to go from VC1 to VC2. Standard. Everything is fine and good. Now, I would like to have a custom animation between the two like so: In sum, VC1 slides out of view while VC2 is beneath it. Just like a stack of paper where you slide away the first sheet (VC1) and thus reveal the sheet beneath (VC2). So what I tried is the following code which is called from VC1 in order to get to VC2. But there are problems with it: MyVC2 *vctwo = [[[MyVC2 alloc] init]

setAnimationRepeatAutoreverses not behaved as I expected

我与影子孤独终老i 提交于 2019-12-05 08:44:16
I am starting to learn to use UIView animation. So I wrote the following lines: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; [UIView setAnimationRepeatCount:2]; [UIView setAnimationRepeatAutoreverses:YES]; CGPoint position = greenView.center; position.y = position.y + 100.0f; position.x = position.x + 100.0f; greenView.center = position; [UIView commitAnimations]; In this case, the UIView (a green box) moved back and fore 2 times. So far so good, BUT I found out that after the moving twice, the green box ended up jumped to the "new position" (position.x + 100

Stop CABasicAnimation at specific point

孤街醉人 提交于 2019-12-05 08:28:51
I'm using a rotation animation created with CABasicAnimation . It rotates a UIView over 2 seconds. But I need to be able to stop it when the UIView is touched. If I remove the animation the view is in the same position as before the animation started. Here's my animation code: float duration = 2.0; float rotationAngle = rotationDirection * ang * speed * duration; //rotationAngle = 3*(2*M_PI);//(double)rotationAngle % (double)(2*M_PI) ; CABasicAnimation* rotationAnimation; rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; rotationAnimation.toValue = [NSNumber

Blending modes on CALayers on screen? Is that possible?

最后都变了- 提交于 2019-12-05 08:24:05
Is that possible to have a CALayer over another one composed using a blending mode on screen? I now that it is possible to do that offscreen using drawinrect, but is it possible to see it live on the screen? thanks for any help. Simple compositing is done for you with CALayers. If the layer is marked as being non-opaque, any transparent or translucent areas will allow content from layers behind the current one to show through. On the Mac, Core Image filters can be used to add effects to this process via the compositingFilter , backgroundFilter , or filters properties. However, Core Image is

Why do docs indicate CALayer animations must be in UIView animation blocks?

£可爱£侵袭症+ 提交于 2019-12-05 08:03:08
I am currently reading Apple's Core Animation Guide , where I found the following passage regarding layer-backed views in iOS: If you want to use Core Animation classes to initiate animations, you must issue all of your Core Animation calls from inside a view-based animation block. The UIView class disables layer animations by default but reenables them inside animation blocks. So any changes you make outside of an animation block are not animated. Just below the quote, the documentation includes the following code listing: [UIView animateWithDuration:1.0 animations:^{ // Change the opacity

Bizarre unwanted animation occurring in iPhone app

你说的曾经没有我的故事 提交于 2019-12-05 07:54:26
I hate to post this but I am seeing unwanted animation in an iPhone app that I am working on. I have never seen this before in my apps or any other apps. This app is for iOS 4.2 and for iPhones only. The weirdness is happening even on an iPhone4. Examples: When the application in question launches a UIAlertView , it "flies in from the top or top left." When any UITableView scrolls, the new (standard) cell data "expands in from the left of the cell" when first coming into view and thus populated. When a UITextField has text entered into it, the typing is slow and you can see the cursor slide to

Layer Position jumps at start of (Core) Animation

China☆狼群 提交于 2019-12-05 07:33:30
So, I'm trying to create a tile flipping effect, like on Windows Phone 7. So far I have the following code, but I have a couple of queries. CALayer *layer = self.theRedSquare.layer; CATransform3D initialTransform = self.theRedSquare.layer.transform; initialTransform.m34 = 1.0 / -1000; [UIView beginAnimations:@"Scale" context:nil]; [UIView setAnimationDuration:1]; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; layer.transform = initialTransform; layer.anchorPoint = CGPointMake(-0.3, 0.5); CATransform3D rotationAndPerspectiveTransform = self.theRedSquare.layer.transform;

Combining autolayout with core animation

試著忘記壹切 提交于 2019-12-05 07:25:35
I'm new to core animation and I'm struggling with one thing - how to combine autolayout with core animation. Actually I've found only one sentence in the documentation of Core Animation which refers to Autolayout here is it Remember to Update View Constraints as Part of Your Animation If you are using constraint-based layout rules to manage the position of your views, you must remove any constraints that might interfere with an animation as part of configuring that animation. Constraints affect any changes you make to the position or size of a view. They also affect the relationships between

Changing speed of an ongoing CAKeyframeAnimation animation

橙三吉。 提交于 2019-12-05 07:21:37
问题 I added an CAKeyframeAnimation with the Key "SpeedBoat" to a CALayer. Now I am trying to change the speed of the animation during the animation. [[self.shipLayer animationForKey:@"SpeedBoat"] setSpeed:([[self.shipLayer animationForKey:@"SpeedBoat"] speed] + deltaTime)]; There seems to be an error in this line. But I do not get any debug informations. What is wrong here? Is it possible to change the speed of an ongoing animation? It would be very nice if somebody could help me :) Best regards

Changing frame of UIView's CALayer (self.view.layer.frame = …) appears to have no effect

让人想犯罪 __ 提交于 2019-12-05 06:46:08
I'm sure I'm missing something basic here. I'm trying out the CALayers 'hello world' code from: http://www.raywenderlich.com/2502/introduction-to-calayers-tutorial Doing the very first example. New single view project in xcode 4.2. No change to the nib/storyboard. Import QuartzCore. Add the following code to ViewDidLoad in the ViewController.m: - (void)viewDidLoad { [super viewDidLoad]; self.view.layer.backgroundColor = [UIColor blueColor].CGColor; self.view.layer.cornerRadius = 30.0; self.view.layer.frame = CGRectMake(20, 20, 20, 20); } I run this (ipad 2 or ipad simulator) and get a full