setAnimationTransition:forView:cache: 运行动画时背景色问题
生活随笔
收集整理的這篇文章主要介紹了
setAnimationTransition:forView:cache: 运行动画时背景色问题
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
首先我描寫敘述一下問題:當(dāng)我從一個(gè)view到另外一個(gè)view的時(shí)候?
解答:這個(gè)問題的解決還須要看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.開始一個(gè)動(dòng)畫塊。
2.在容器視圖中設(shè)置轉(zhuǎn)換。 3.在容器視圖中移除子視圖。 4.在容器視圖中加入子視圖。 5.結(jié)束動(dòng)畫塊。
就是他全部的操作都是在父View上進(jìn)行操作的。我的代碼是這樣寫得:
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;}}
直接設(shè)置要切換到view的父view的背景色就ok了。
當(dāng)然了,有時(shí)候他的父view也可能是window。
詳細(xì)情況詳細(xì)分析吧。
希望能幫助一些人。
總結(jié)
以上是生活随笔為你收集整理的setAnimationTransition:forView:cache: 运行动画时背景色问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Indri和Terrier搜索引擎的使用
- 下一篇: Mycat 月分片方法 - pursue