setAnimationTransition:forView:cache: 运行动画时背景色问题
2016-03-10 18:06
453 查看
首先我描写叙述一下问题:当我从一个view到另外一个view的时候?
解答:这个问题的解决还须要看setAnimationTransition:forView:cache: 官方Api,官方是这样说的:
1.Begin an animation block.
2.Set the transition on the container view.
3.Remove the subview from the container view.
4.Add the new subview to the container view.
5.Commit the animation block.
1.開始一个动画块。
2.在容器视图中设置转换。 3.在容器视图中移除子视图。 4.在容器视图中加入子视图。 5.结束动画块。
就是他全部的操作都是在父View上进行操作的。我的代码是这样写得:
直接设置要切换到view的父view的背景色就ok了。
当然了,有时候他的父view也可能是window。
详细情况详细分析吧。
希望能帮助一些人。
解答:这个问题的解决还须要看setAnimationTransition:forView:cache: 官方Api,官方是这样说的:
1.Begin an animation block.
2.Set the transition on the container view.
3.Remove the subview from the container view.
4.Add the new subview to the container view.
5.Commit the animation block.
1.開始一个动画块。
2.在容器视图中设置转换。 3.在容器视图中移除子视图。 4.在容器视图中加入子视图。 5.结束动画块。
就是他全部的操作都是在父View上进行操作的。我的代码是这样写得:
AppDelegate * delegate = [UIApplication sharedApplication].delegate; delegate.nav_Center.view.backgroundColor = [UIColor clearColor]; //[delegate.window setBackgroundColor:[UIColor whiteColor]]; [self.navigationController.view superview].backgroundColor = [UIColor whiteColor]; for (UIViewController * c in delegate.nav_Center.viewControllers) { if([c isKindOfClass:[TrendViewController class]]) { if (curve>=0) { [UIView beginAnimations: @"PopNav" context: nil]; [UIView setAnimationCurve: curve]; [UIView setAnimationDuration:0.75]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; NSLog(@"===%@=%@",[[self.navigationController.view superview] class],[self.navigationController.view class]); [self.navigationController popViewControllerAnimated:NO]; [UIView commitAnimations]; } else { [self.navigationController popViewControllerAnimated:YES]; } return YES; } }
直接设置要切换到view的父view的背景色就ok了。
当然了,有时候他的父view也可能是window。
详细情况详细分析吧。
希望能帮助一些人。
相关文章推荐
- 11、Linq的使用
- tableviewCell实用小技术
- 多图片上传预览实现以及移动端web多文件上传
- HDU 1.2.5 IBM Minus One
- RecyclerView 增加下拉刷新,上拉加载更多功能分析
- HDU 1.2.4 decimal system
- Hadoop在运行几个T数据量时报堆内存溢出
- mac倾倒废纸篓提示文件正在使用中的一种解决办法
- C语言建立二叉数并遍历,求深度,求叶子数
- iOS 自动将@3x的图片处理成@1x的图片
- 引入别人的项目报错误 Cause:org/gradle/api/publication/maven/internal/DefaultMavenFactory
- 机器学习攻略
- ECMAScript5之Object
- popupwindow里含有listview,显示在控件上方
- 初级码农,第一次做微信项目,幸好有老大带我飞!
- AIDL的使用
- HDU 1.2.3 The Seven Percent Solution
- 鼠标滚轮的兼容写法
- iOS开发Xcode断点调试技巧
- window 下安装redis