标签:ios动画 animatewithduration catransition setanimationduration uiview commitanimati
第一种
CATransition *transition = [CATransition animation]; transition.duration = 0.4f;//时间 transition.type = kCATransitionPush;//动画的效果 transition.subtype = kCATransitionFromBottom;//动画的目的地 [self.view addSubview:_backGroundView];//这是是自己要做的事情一般是添加一个View 这个需要自己写 [self.view.layer addAnimation:transition forKey:@"animation"];
[UIView beginAnimations:@"animation" context:nil]; [UIView setAnimationDuration:2.0f];//时间 [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];//效果 [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.view cache:YES]; [self.view addSubview:_backGroundView];//要做的事情 [UIView commitAnimations];
[UIView animateWithDuration:1.0 animations:^{ _backGroundView.frame = CGRectMake(0, originY, _screenSize.width, 0);//要达到的状态值 }completion:^(BOOL finished){ [_backGroundView removeFromSuperview]; }];
标签:ios动画 animatewithduration catransition setanimationduration uiview commitanimati
原文地址:http://blog.csdn.net/zhouzhoujianquan/article/details/44962059