當前位置:
首頁 >
setAnimationTransition:forView:cache: 运行动画时背景色问题
發布時間:2025/7/14
71
豆豆
生活随笔
收集整理的這篇文章主要介紹了
setAnimationTransition:forView:cache: 运行动画时背景色问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
首先我描寫敘述一下問題:當我從一個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上進行操作的。我的代碼是這樣寫得:
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。
詳細情況詳細分析吧。
希望能幫助一些人。
總結
以上是生活随笔為你收集整理的setAnimationTransition:forView:cache: 运行动画时背景色问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Indri和Terrier搜索引擎的使用
- 下一篇: Mycat 月分片方法 - pursue