UIView 动画
下面两段代码实现的内容是相同的 都是view 的动画效果
//动画 view上移
- (void)viewUp {
[UIView animateWithDuration:1 animations:^{
self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y-150, self.view.frame.size.width, self.view.frame.size.height);
} completion:^(BOOL finished) {
}];
}
- (void)viewUp1 {
//设置动画的名字
[UIView beginAnimations:@"Animation" context:nil];
//设置动画的间隔时间
[UIView setAnimationDuration:1];
//??使用当前正在运行的状态开始下一段动画
[UIView setAnimationBeginsFromCurrentState: YES];
//设置视图移动的位移
self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y - 150, self.view.frame.size.width, self.view.frame.size.height);
//设置动画结束
[UIView commitAnimations];
}