https://www.jianshu.com/p/6e326068edeb
https://www.jianshu.com/p/5abc038e4d94
1、块方式:
- (IBAction)btnUnfold_youch:(id)sender { CGRect dragViewRect = self.dragView.frame; if (dragViewRect.origin.y + 30 <= self.tabBarController.tabBar.frame.origin.y) { dragViewRect.origin.y = self.tabBarController.tabBar.frame.origin.y - 30; [UIView animateWithDuration: 0.5 animations: ^{ self.dragView.frame = dragViewRect; } completion: nil]; } //[self changeFrame]; }
2、提交方式:
- (IBAction)btnUnfold_youch:(id)sender { // CGRect dragViewRect = self.dragView.frame; // // if (dragViewRect.origin.y + 30 <= self.tabBarController.tabBar.frame.origin.y) { // dragViewRect.origin.y = self.tabBarController.tabBar.frame.origin.y - 30; // [UIView animateWithDuration: 0.5 animations: ^{ // self.dragView.frame = dragViewRect; // } completion: nil]; // } [self changeFrame]; } - (void)changeFrame { CGRect dragViewRect = self.dragView.frame; if (dragViewRect.origin.y + 30 <= self.tabBarController.tabBar.frame.origin.y) { [UIView beginAnimations:@"FrameAni" context:nil]; [UIView setAnimationDuration:0.5]; [UIView setAnimationDelegate:self.dragView]; [UIView setAnimationWillStartSelector:@selector(startAni:)]; [UIView setAnimationDidStopSelector:@selector(stopAni:)]; [UIView setAnimationRepeatCount:1]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; dragViewRect.origin.y = self.tabBarController.tabBar.frame.origin.y - 30; self.dragView.frame = dragViewRect; [UIView commitAnimations]; } } - (void)startAni:(NSString *)aniID { NSLog(@"%@ start",aniID); } - (void)stopAni:(NSString *)aniID { NSLog(@"%@ stop",aniID); }