在进行页面切换的时候,对于在视图上添加一部分动画效果的话,使页面的切换更加柔和,提升用户体验。
uiview 的各种动画 的动画效果 常见的有几种方式
第一种:有对应的旋转效果的
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.6];
[UIView transitionWithView:imgView duration:0.6 // 在noteView视图上设置过渡效果 是个枚举类型
options:UIViewAnimationOptionTransitionNone
animations:^{
imgView.alpha = 0;
}
completion:^(BOOL finished){
[imgView removeFromSuperview];
}];
[UIView commitAnimations];
beginAnimations 开始动画
setAnimationDuration 持续时间
transitionWithView:变动的视图 duration:持续时间 options:动画的效果 animations:^{需要操作的内容} completion:^(bool finished){动画完成后执行的内容}
commitAnimations结束动画
第二种:没有效果的动画
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.6];
[UIView animationWithDuration:0.6 // 在noteView视图上设置过渡效果
options:UIViewAnimationOptionTransitionNone
animations:^{
imgView.alpha = 0;
}
completion:^(BOOL finished){
[imgView removeFromSuperview];
}];
[UIView commitAnimations];