1. I wrote a small Demo to implement up and down movement: the main code is as follows: [cpp]-(IBAction) upChange :( id) sender {if (typeView = down) {[self. downBtn setHidden: NO]; [self. upBtn setHidden: NO]; [UIView animateWithDuration: 0.5 animations: ^ {self. upView. center = CGPointMake (self. upView. center. x, 0); self. downView. center = CGPointMake (self. downView. center. x, (self. upView. frame. size. height + self. downView. frame. size. height)/2);}]; typeView = middle;} Else if (typeView = middle) {[self. downBtn setHidden: NO]; [self. upBtn setHidden: YES]; [UIView animateWithDuration: 0.5 animations: ^ {self. upView. center = CGPointMake (self. upView. center. x,-(self. upView. frame. size. height/2); self. downView. center = CGPointMake (self. downView. center. x, self. downView. frame. size. height/2) ;}]; typeView = up ;}- (IBAction) downChange :( id) sender {if (typeView = midd Le) {[self. downBtn setHidden: YES]; [self. upBtn setHidden: NO]; [UIView animateWithDuration: 0.5 animations: ^ {self. upView. center = CGPointMake (self. upView. center. x, self. upView. frame. size. height/2); self. downView. center = CGPointMake (self. downView. center. x, self. upView. frame. size. height + self. downView. frame. size. height/2) ;}]; typeView = down;} else if (typeView = up) {[self. downBtn setHidden: NO]; [Self. upBtn setHidden: NO]; [UIView animateWithDuration: 0.5 animations: ^ {self. upView. center = CGPointMake (self. upView. center. x, 0); self. downView. center = CGPointMake (self. downView. center. x, (self. upView. frame. size. height + self. downView. frame. size. height)/2);}]; typeView = middle;}-(IBAction) upChange :( id) sender {if (typeView = down) {[self. downBtn setHidden: NO]; [self. upBtn setHidden: NO]; [UIView animateWithDuration: 0.5 animations: ^ {self. upView. center = CGPointMake (self. upView. center. x, 0); self. downView. center = CGPointMake (self. downView. center. x, (self. upView. frame. size. height + self. downView. frame. size. height)/2);}]; typeView = middle;} else if (typeView = middle) {[self. downBtn setHidden: NO]; [self. upBtn setHidden: YES]; [UIView animateWithDuration: 0.5 animations: ^ {self. upView. Center = CGPointMake (self. upView. center. x,-(self. upView. frame. size. height/2); self. downView. center = CGPointMake (self. downView. center. x, self. downView. frame. size. height/2);}]; typeView = up;}-(IBAction) downChange :( id) sender {if (typeView = middle) {[self. downBtn setHidden: YES]; [self. upBtn setHidden: NO]; [UIView animateWithDuration: 0.5 animations: ^ {self. upView. center = CGPointMake (self. UpView. center. x, self. upView. frame. size. height/2); self. downView. center = CGPointMake (self. downView. center. x, self. upView. frame. size. height + self. downView. frame. size. height/2) ;}]; typeView = down;} else if (typeView = up) {[self. downBtn setHidden: NO]; [self. upBtn setHidden: NO]; [UIView animateWithDuration: 0.5 animations: ^ {self. upView. center = CGPointMake (self. upView. center. x, 0); self. downView. Center = CGPointMake (self. downView. center. x, (self. upView. frame. size. height + self. downView. frame. size. height)/2) ;}]; typeView = middle ;}} this is the main code, and there are also some small details that need attention, such as the size of your two views, the exact location must be calculated. The following describes how to use the [UIView animateWithDuration] method: function prototype: + (void) animateWithDuration :( NSTimeInterval) duration animations :( void (^) (void )) animations _ OSX_AVAILABLE_STARTING (_ MAC_NA ,__ IPHONE_4_0); // delay = 0.0, options = 0, completion = NULL duration: animation duration animations: the code block defines all attributes of the animation to be completed for all views. There are two other functions: + (void) animateWithDuration :( NSTimeInterval) duration delay :( NSTimeInterval) delay options :( UIViewAnimation Options) options animations :( void (^) (void) animations completion :( void (^) (BOOL finished) completion _ OSX_AVAILABLE_STARTING (_ MAC_NA ,__ IPHONE_4_0 ); + (void) animateWithDuration :( NSTimeInterval) duration animations :( void (^) (void) animations completion :( void (^) (BOOL finished) completion _ signature (_ MAC_NA, __iphone_4_0); // delay = 0.0, options = 0 options: it is the animation execution option completion: it is to be executed after the animation is completed Line of code.