¡@

Home 

2014/10/15 ¤U¤È 10:03:38

iphone Programming Glossary: animation

How can I animate the movement of a view or image along a curved path?

http://stackoverflow.com/questions/1142727/how-can-i-animate-the-movement-of-a-view-or-image-along-a-curved-path

where an image of the item follows a curved path and ends up at the cart tab. How can I create an animation of an image along a curve like this iphone objective c ios cocoa touch core animation share improve.. I create an animation of an image along a curve like this iphone objective c ios cocoa touch core animation share improve this question To expand upon what Nikolai said the best way to handle this is to use.. 1.0f CGRect imageFrame imageViewForAnimation.frame Your image frame.origin from where the animation need to get start CGPoint viewOrigin imageViewForAnimation.frame.origin viewOrigin.y viewOrigin.y imageFrame.size.height..

iPhone viewWillAppear not firing

http://stackoverflow.com/questions/131062/iphone-viewwillappear-not-firing

message directly. Failing to send the view controller this message will prevent any associated animation from being displayed. The problem is that they don't describe how to do this. What the hell does directly..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

help pointers or example code snippets would be really appreciated iphone ios cocoa touch core animation share improve this question As Ben said you'll need to work with the UIView's layer using a CATransform3D..

Cancel a UIView animation?

http://stackoverflow.com/questions/554997/cancel-a-uiview-animation

a UIView animation Is it possible to cancel a UIView animation while it is in progress Or would I have to drop to the.. a UIView animation Is it possible to cancel a UIView animation while it is in progress Or would I have to drop to the CA level i.e. I've done something like this maybe.. Or would I have to drop to the CA level i.e. I've done something like this maybe setting an end animation action too UIView beginAnimations nil context NULL UIView setAnimationDuration duration UIView setAnimationCurve..

iPhone UIView Animation Best Practice

http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice

sample project from apple uses code like CATransition applicationLoadViewIn CATransition animation applicationLoadViewIn setDuration 1 applicationLoadViewIn setType kCATransitionReveal applicationLoadViewIn.. I've been unable to get the second approach to work correctly. iphone ios cocoa touch uiview core animation share improve this question From the UIView reference 's section about the beginAnimations context.. Use of this method is discouraged in iPhone OS 4.0 and later. You should use the block based animation methods instead. Eg of Block based Animation based on Tom's Comment UIView transitionWithView mysuperview..

How can I animate the movement of a view or image along a curved path?

http://stackoverflow.com/questions/1142727/how-can-i-animate-the-movement-of-a-view-or-image-along-a-curved-path

this question To expand upon what Nikolai said the best way to handle this is to use Core Animation to animate the motion of the image or view along a Bezier path. This is accomplished using a CAKeyframeAnimation... the motion of the image or view along a Bezier path. This is accomplished using a CAKeyframeAnimation. For example I've used the following code to animate an image of a view into an icon to indicate saving.. First of all import QuartzCore header file #import QuartzCore QuartzCore.h UIImageView imageViewForAnimation UIImageView alloc initWithImage imageToAnimate imageViewForAnimation.alpha 1.0f CGRect imageFrame imageViewForAnimation.frame..

Custom animation for pushing a UIViewController

http://stackoverflow.com/questions/1406037/custom-animation-for-pushing-a-uiviewcontroller

nil self.view addSubview coming.view coming.view.frame CGRectMake 160 160 0 0 UIView beginAnimations @ frame context nil UIView setAnimationDuration 4 UIView setAnimationCurve UIViewAnimationCurveEaseInOut.. coming.view.frame CGRectMake 160 160 0 0 UIView beginAnimations @ frame context nil UIView setAnimationDuration 4 UIView setAnimationCurve UIViewAnimationCurveEaseInOut coming viewWillAppear YES going viewWillAppear.. 160 160 0 0 UIView beginAnimations @ frame context nil UIView setAnimationDuration 4 UIView setAnimationCurve UIViewAnimationCurveEaseInOut coming viewWillAppear YES going viewWillAppear YES coming.view.frame..

Changing my CALayer's anchorPoint moves the view

http://stackoverflow.com/questions/1968017/changing-my-calayers-anchorpoint-moves-the-view

touch uiview share improve this question The Layer Geometry and Transforms section of the Core Animation Programming Guide explains the relationship between a CALayer's position and anchorPoint properties...

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

is possible I've investigated using CALayer and have run through all the pragmatic programmer Core Animation podcasts but I'm still no clearer on how to create this kind of transform on an iPhone. Any help pointers..

CADisplayLink OpenGL rendering breaks UIScrollView behaviour

http://stackoverflow.com/questions/5944050/cadisplaylink-opengl-rendering-breaks-uiscrollview-behaviour

UIScrollView broken and halts scrolling with OpenGL rendering related CADisplayLink NSRunLoop Animation in OpenGL ES view freezes when UIScrollView is dragged on iPhone iphone opengl es share improve this..

iPhone UIView Animation Best Practice

http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice

UIView Animation Best Practice What is considered best practice for animating view transitions on the iPhone For example.. CAMediaTimingFunction functionWithName kCAMediaTimingFunctionEaseIn myview layer addAnimation applicationLoadViewIn forKey kCATransitionReveal but there are also code snippets floating around the.. but there are also code snippets floating around the net that look like this UIView beginAnimations nil context nil UIView setAnimationDuration 0.75 UIView setAnimationDelegate self UIView setAnimationTransition..

How can I animate the movement of a view or image along a curved path?

http://stackoverflow.com/questions/1142727/how-can-i-animate-the-movement-of-a-view-or-image-along-a-curved-path

add an item to the shopping cart I want to create an effect where an image of the item follows a curved path and ends up at the cart tab. How can I create an animation of an image along a curve like this iphone objective c ios cocoa touch core animation share improve this question To expand upon what Nikolai said the best.. follows a curved path and ends up at the cart tab. How can I create an animation of an image along a curve like this iphone objective c ios cocoa touch core animation share improve this question To expand upon what Nikolai said the best way to handle this is to use Core Animation to animate the motion of the image or view.. alloc initWithImage imageToAnimate imageViewForAnimation.alpha 1.0f CGRect imageFrame imageViewForAnimation.frame Your image frame.origin from where the animation need to get start CGPoint viewOrigin imageViewForAnimation.frame.origin viewOrigin.y viewOrigin.y imageFrame.size.height 2.0f viewOrigin.x viewOrigin.x imageFrame.size.width..

iPhone viewWillAppear not firing

http://stackoverflow.com/questions/131062/iphone-viewwillappear-not-firing

controller you should send the associated view controller this message directly. Failing to send the view controller this message will prevent any associated animation from being displayed. The problem is that they don't describe how to do this. What the hell does directly mean. How do you indirectly add a view. I am fairly new..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

on how to create this kind of transform on an iPhone. Any help pointers or example code snippets would be really appreciated iphone ios cocoa touch core animation share improve this question As Ben said you'll need to work with the UIView's layer using a CATransform3D to perform the layer's rotation. The trick to get..

Cancel a UIView animation?

http://stackoverflow.com/questions/554997/cancel-a-uiview-animation

a UIView animation Is it possible to cancel a UIView animation while it is in progress Or would I have to drop to the CA level i.e. I've done something like this maybe setting an.. a UIView animation Is it possible to cancel a UIView animation while it is in progress Or would I have to drop to the CA level i.e. I've done something like this maybe setting an end animation action too UIView beginAnimations.. possible to cancel a UIView animation while it is in progress Or would I have to drop to the CA level i.e. I've done something like this maybe setting an end animation action too UIView beginAnimations nil context NULL UIView setAnimationDuration duration UIView setAnimationCurve UIViewAnimationCurveLinear other animation properties..

iPhone UIView Animation Best Practice

http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice

view transitions on the iPhone For example the ViewTransitions sample project from apple uses code like CATransition applicationLoadViewIn CATransition animation applicationLoadViewIn setDuration 1 applicationLoadViewIn setType kCATransitionReveal applicationLoadViewIn setTimingFunction CAMediaTimingFunction functionWithName.. provide a snippet as well it'd be much appreciated. NOTE I've been unable to get the second approach to work correctly. iphone ios cocoa touch uiview core animation share improve this question From the UIView reference 's section about the beginAnimations context method Use of this method is discouraged in iPhone OS 4.0.. reference 's section about the beginAnimations context method Use of this method is discouraged in iPhone OS 4.0 and later. You should use the block based animation methods instead. Eg of Block based Animation based on Tom's Comment UIView transitionWithView mysuperview duration 0.75 options UIViewAnimationTransitionFlipFromRight..

How can I animate the movement of a view or image along a curved path?

http://stackoverflow.com/questions/1142727/how-can-i-animate-the-movement-of-a-view-or-image-along-a-curved-path

iphone objective c ios cocoa touch core animation share improve this question To expand upon what Nikolai said the best way to handle this is to use Core Animation to animate the motion of the image or view along a Bezier path. This is accomplished using a CAKeyframeAnimation. For example I've used the following code to animate.. the best way to handle this is to use Core Animation to animate the motion of the image or view along a Bezier path. This is accomplished using a CAKeyframeAnimation. For example I've used the following code to animate an image of a view into an icon to indicate saving as can be seen in the video for this application First of.. saving as can be seen in the video for this application First of all import QuartzCore header file #import QuartzCore QuartzCore.h UIImageView imageViewForAnimation UIImageView alloc initWithImage imageToAnimate imageViewForAnimation.alpha 1.0f CGRect imageFrame imageViewForAnimation.frame Your image frame.origin from where..

Custom animation for pushing a UIViewController

http://stackoverflow.com/questions/1406037/custom-animation-for-pushing-a-uiviewcontroller

expand animation with the following code if coming.view superview nil self.view addSubview coming.view coming.view.frame CGRectMake 160 160 0 0 UIView beginAnimations @ frame context nil UIView setAnimationDuration 4 UIView setAnimationCurve UIViewAnimationCurveEaseInOut coming viewWillAppear YES going viewWillAppear YES coming.view.frame.. if coming.view superview nil self.view addSubview coming.view coming.view.frame CGRectMake 160 160 0 0 UIView beginAnimations @ frame context nil UIView setAnimationDuration 4 UIView setAnimationCurve UIViewAnimationCurveEaseInOut coming viewWillAppear YES going viewWillAppear YES coming.view.frame CGRectMake 0 0 320 480 going.. self.view addSubview coming.view coming.view.frame CGRectMake 160 160 0 0 UIView beginAnimations @ frame context nil UIView setAnimationDuration 4 UIView setAnimationCurve UIViewAnimationCurveEaseInOut coming viewWillAppear YES going viewWillAppear YES coming.view.frame CGRectMake 0 0 320 480 going viewDidDisappear YES coming..

Changing my CALayer's anchorPoint moves the view

http://stackoverflow.com/questions/1968017/changing-my-calayers-anchorpoint-moves-the-view

207 center point 272.500000 242.500000 iphone cocoa cocoa touch uiview share improve this question The Layer Geometry and Transforms section of the Core Animation Programming Guide explains the relationship between a CALayer's position and anchorPoint properties. Basically the position of a layer is specified in terms of..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

UIView such as seen in coverflow Does anyonew know if this is possible I've investigated using CALayer and have run through all the pragmatic programmer Core Animation podcasts but I'm still no clearer on how to create this kind of transform on an iPhone. Any help pointers or example code snippets would be really appreciated ..

CADisplayLink OpenGL rendering breaks UIScrollView behaviour

http://stackoverflow.com/questions/5944050/cadisplaylink-opengl-rendering-breaks-uiscrollview-behaviour

run modes Thanks in advance Promised links to similar questions UIScrollView broken and halts scrolling with OpenGL rendering related CADisplayLink NSRunLoop Animation in OpenGL ES view freezes when UIScrollView is dragged on iPhone iphone opengl es share improve this question It's possible that slow updates on the main thread..

iPhone UIView Animation Best Practice

http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice

UIView Animation Best Practice What is considered best practice for animating view transitions on the iPhone For example the ViewTransitions sample project from apple uses code.. setType kCATransitionReveal applicationLoadViewIn setTimingFunction CAMediaTimingFunction functionWithName kCAMediaTimingFunctionEaseIn myview layer addAnimation applicationLoadViewIn forKey kCATransitionReveal but there are also code snippets floating around the net that look like this UIView beginAnimations nil context.. layer addAnimation applicationLoadViewIn forKey kCATransitionReveal but there are also code snippets floating around the net that look like this UIView beginAnimations nil context nil UIView setAnimationDuration 0.75 UIView setAnimationDelegate self UIView setAnimationTransition UIViewAnimationTransitionFlipFromRight forView..

How can I animate the movement of a view or image along a curved path?

http://stackoverflow.com/questions/1142727/how-can-i-animate-the-movement-of-a-view-or-image-along-a-curved-path

to create an effect where an image of the item follows a curved path and ends up at the cart tab. How can I create an animation of an image along a curve like this iphone objective c ios cocoa touch core animation share improve this question To.. cart tab. How can I create an animation of an image along a curve like this iphone objective c ios cocoa touch core animation share improve this question To expand upon what Nikolai said the best way to handle this is to use Core Animation to.. imageViewForAnimation.alpha 1.0f CGRect imageFrame imageViewForAnimation.frame Your image frame.origin from where the animation need to get start CGPoint viewOrigin imageViewForAnimation.frame.origin viewOrigin.y viewOrigin.y imageFrame.size.height..

iPhone viewWillAppear not firing

http://stackoverflow.com/questions/131062/iphone-viewwillappear-not-firing

view controller this message directly. Failing to send the view controller this message will prevent any associated animation from being displayed. The problem is that they don't describe how to do this. What the hell does directly mean. How do you..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

on an iPhone. Any help pointers or example code snippets would be really appreciated iphone ios cocoa touch core animation share improve this question As Ben said you'll need to work with the UIView's layer using a CATransform3D to perform..

Cancel a UIView animation?

http://stackoverflow.com/questions/554997/cancel-a-uiview-animation

a UIView animation Is it possible to cancel a UIView animation while it is in progress Or would I have to drop to the CA level i.e. I've done.. a UIView animation Is it possible to cancel a UIView animation while it is in progress Or would I have to drop to the CA level i.e. I've done something like this maybe setting an end.. it is in progress Or would I have to drop to the CA level i.e. I've done something like this maybe setting an end animation action too UIView beginAnimations nil context NULL UIView setAnimationDuration duration UIView setAnimationCurve UIViewAnimationCurveLinear..

iPhone UIView Animation Best Practice

http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice

example the ViewTransitions sample project from apple uses code like CATransition applicationLoadViewIn CATransition animation applicationLoadViewIn setDuration 1 applicationLoadViewIn setType kCATransitionReveal applicationLoadViewIn setTimingFunction.. appreciated. NOTE I've been unable to get the second approach to work correctly. iphone ios cocoa touch uiview core animation share improve this question From the UIView reference 's section about the beginAnimations context method Use of this.. context method Use of this method is discouraged in iPhone OS 4.0 and later. You should use the block based animation methods instead. Eg of Block based Animation based on Tom's Comment UIView transitionWithView mysuperview duration 0.75..

How can I animate the movement of a view or image along a curved path?

http://stackoverflow.com/questions/1142727/how-can-i-animate-the-movement-of-a-view-or-image-along-a-curved-path

animation share improve this question To expand upon what Nikolai said the best way to handle this is to use Core Animation to animate the motion of the image or view along a Bezier path. This is accomplished using a CAKeyframeAnimation. For example.. Core Animation to animate the motion of the image or view along a Bezier path. This is accomplished using a CAKeyframeAnimation. For example I've used the following code to animate an image of a view into an icon to indicate saving as can be seen in.. this application First of all import QuartzCore header file #import QuartzCore QuartzCore.h UIImageView imageViewForAnimation UIImageView alloc initWithImage imageToAnimate imageViewForAnimation.alpha 1.0f CGRect imageFrame imageViewForAnimation.frame..

Custom animation for pushing a UIViewController

http://stackoverflow.com/questions/1406037/custom-animation-for-pushing-a-uiviewcontroller

if coming.view superview nil self.view addSubview coming.view coming.view.frame CGRectMake 160 160 0 0 UIView beginAnimations @ frame context nil UIView setAnimationDuration 4 UIView setAnimationCurve UIViewAnimationCurveEaseInOut coming viewWillAppear.. addSubview coming.view coming.view.frame CGRectMake 160 160 0 0 UIView beginAnimations @ frame context nil UIView setAnimationDuration 4 UIView setAnimationCurve UIViewAnimationCurveEaseInOut coming viewWillAppear YES going viewWillAppear YES coming.view.frame.. CGRectMake 160 160 0 0 UIView beginAnimations @ frame context nil UIView setAnimationDuration 4 UIView setAnimationCurve UIViewAnimationCurveEaseInOut coming viewWillAppear YES going viewWillAppear YES coming.view.frame CGRectMake 0 0 320..

Changing my CALayer's anchorPoint moves the view

http://stackoverflow.com/questions/1968017/changing-my-calayers-anchorpoint-moves-the-view

iphone cocoa cocoa touch uiview share improve this question The Layer Geometry and Transforms section of the Core Animation Programming Guide explains the relationship between a CALayer's position and anchorPoint properties. Basically the position..

Animating a custom property of CALayer subclass

http://stackoverflow.com/questions/2395382/animating-a-custom-property-of-calayer-subclass

subclass MyLayer that has a NSInteger property called myInt. I'd really like to animate this property via CABasicAnimation but it seems CABasicAnimation only works on so called animatable properties bounds position etc . Is there something I can.. a NSInteger property called myInt. I'd really like to animate this property via CABasicAnimation but it seems CABasicAnimation only works on so called animatable properties bounds position etc . Is there something I can override to make my custom.. animatable iphone core animation calayer share improve this question Yes it's possible only in the latest Core Animation releases though I believe i.e. iPhone 3.0 and OS X 10.6 . Make your property dynamic so that CA implements the accessors..

Drawing formulas with Quartz 2d

http://stackoverflow.com/questions/2907045/drawing-formulas-with-quartz-2d

which does just that trust me when I say typesetting equations is not a trivial undertaking. In my case I used Core Animation layers to construct the sub elements of a parsed equation. The equations are constructed hierarchically and the operations..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

know if this is possible I've investigated using CALayer and have run through all the pragmatic programmer Core Animation podcasts but I'm still no clearer on how to create this kind of transform on an iPhone. Any help pointers or example code..

Method for animating images (like a movie) on iPhone without using MPMoviePlayer

http://stackoverflow.com/questions/442076/method-for-animating-images-like-a-movie-on-iphone-without-using-mpmovieplayer

I know we could use UIImageView to do this by setting the UIImageView animationImages property and then calling startAnimation however we are going to have over 100 images in our animation so memory usage will be maxed out. Does anyone have any nice.. animation so memory usage will be maxed out. Does anyone have any nice ways to do this kind of animation Using Core Animation or OpenGL My guess is that we'd need to create an image buffer and as we load new images we display images from the image.. images from the image buffer iphone animation core animation share improve this question You could use a Core Animation CALayer to host your animation and swap a series of CALayers in and out of that main layer to perform your frame by frame..

how can I use animation in cocos2d?

http://stackoverflow.com/questions/486609/how-can-i-use-animation-in-cocos2d

improve this question I have no idea how to do this in cocos2d or even what that is but you can do this using Core Animation either with CALayers or UIViews. Probably the simplest way would be to create a UIImageView containing an image of your.. to spin use the following code CATransform3D rotationTransform CATransform3DMakeRotation 1.0f M_PI 0 0 1.0 CABasicAnimation rotationAnimation rotationAnimation CABasicAnimation animationWithKeyPath @ transform rotationAnimation.toValue NSValue.. following code CATransform3D rotationTransform CATransform3DMakeRotation 1.0f M_PI 0 0 1.0 CABasicAnimation rotationAnimation rotationAnimation CABasicAnimation animationWithKeyPath @ transform rotationAnimation.toValue NSValue valueWithCATransform3D..

How to create custom easing function with Core Animation?

http://stackoverflow.com/questions/5161465/how-to-create-custom-easing-function-with-core-animation

to create custom easing function with Core Animation I am animating a CALayer along a CGPath QuadCurve quite nicely in iOS. But I'd like to use a more interesting easing function.. animation tween share improve this question I found this Cocoa with Love Parametric acceleration curves in Core Animation But I think it can be made a little simpler and more readable by using blocks. So we can define a category on CAKeyframeAnimation.. I think it can be made a little simpler and more readable by using blocks. So we can define a category on CAKeyframeAnimation that looks something like this CAKeyframeAnimation Parametric.h this should be a function that takes a time value between..

UIView vertical flip animation

http://stackoverflow.com/questions/5392629/uiview-vertical-flip-animation

vertical flip animation I have an iOS UIView with UIViewAnimationTransitionFlipFromRight . I need it to flip vertically though. The page curl transition won't cut it. I assume this will.. iphone ios uiview core animation share improve this question As of iOS 5.0 there's no need to write your own Core Animation transformation to do vertical flips. Just use UIKit's UIViewAnimationOptionTransitionFlipFromTop and UIViewAnimationOptionTransitionFlipFromBottom.. iOS 5.0 there's no need to write your own Core Animation transformation to do vertical flips. Just use UIKit's UIViewAnimationOptionTransitionFlipFromTop and UIViewAnimationOptionTransitionFlipFromBottom transitions and all this stuff becomes a single..

CADisplayLink OpenGL rendering breaks UIScrollView behaviour

http://stackoverflow.com/questions/5944050/cadisplaylink-opengl-rendering-breaks-uiscrollview-behaviour

to similar questions UIScrollView broken and halts scrolling with OpenGL rendering related CADisplayLink NSRunLoop Animation in OpenGL ES view freezes when UIScrollView is dragged on iPhone iphone opengl es share improve this question It's..

iPhone UIView Animation Best Practice

http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice

UIView Animation Best Practice What is considered best practice for animating view transitions on the iPhone For example the ViewTransitions.. setTimingFunction CAMediaTimingFunction functionWithName kCAMediaTimingFunctionEaseIn myview layer addAnimation applicationLoadViewIn forKey kCATransitionReveal but there are also code snippets floating around the net that look like.. forKey kCATransitionReveal but there are also code snippets floating around the net that look like this UIView beginAnimations nil context nil UIView setAnimationDuration 0.75 UIView setAnimationDelegate self UIView setAnimationTransition UIViewAnimationTransitionFlipFromRight..

iPhone Core Animation - Drawing a Circle

http://stackoverflow.com/questions/7991086/iphone-core-animation-drawing-a-circle

Core Animation Drawing a Circle I wish to create an animation. The best way I can explain this is if you can imagine drawing a circle... space of 10 or so seconds. The closet I have come to this is to draw a point rotating around a center point using Core Animation using the sample code here . But I am at a loss on how to draw the circle Any suggestions are very welcome. Many Thanks.. should do is to animate the stroke of a CAShapeLayer where the path is a circle. This will be accelerated using Core Animation and is less messy then to draw part of a circle in drawRect . The code below will create a circle shape layer in the center..

UIButton can't be touched while animated with UIView animateWithDuration

http://stackoverflow.com/questions/8346100/uibutton-cant-be-touched-while-animated-with-uiview-animatewithduration

with UIView animateWithDuration I have the following code UIView animateWithDuration 0.3 delay 0.0 options UIViewAnimationCurveEaseOut UIViewAnimationOptionAllowUserInteraction animations ^ CGRect r btn frame r.origin.y 40 btn setFrame r .. I have the following code UIView animateWithDuration 0.3 delay 0.0 options UIViewAnimationCurveEaseOut UIViewAnimationOptionAllowUserInteraction animations ^ CGRect r btn frame r.origin.y 40 btn setFrame r completion ^ BOOL done if.. 40 btn setFrame r completion ^ BOOL done if done UIView animateWithDuration 0.3 delay 1 options UIViewAnimationOptionCurveEaseIn UIViewAnimationOptionAllowUserInteraction animations ^ CGRect r btn frame r.origin.y 40 btn..