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。

详细情况详细分析吧。

希望能帮助一些人。

时间: 2024-12-15 07:12:58

setAnimationTransition:forView:cache: 运行动画时背景色问题的相关文章

setAnimationTransition:forView:cache: 执行动画时背景色问题

一.起因 最近在玩Boost库.当然首先是要进行Booist库的安装和配置.于是浅墨Google了一下boost库的安装配置攻略,下载了最新版1.55的boost库,就愉悦地开始进行配置了. 当进行到第五步,要在VS命令提示符中运行bootstrap.bat的时候,问题就来了,按着攻略打开Visual Studio2010命令提示符,就迎面报错: "Setting environment for using MicrosoftVisual Studio. 此时不应有\Mirosoft"

Unity ---- 运行动画时修改局部骨骼的rotation

这几天一直被一个问题困扰着.因为要做一个射击的小demo,涉及到地面上的人射击空中的飞机. 但是动画中的人物的头部要看向飞机才会更真实,可是我人物里的头用Transfor根本找不到啊!!! 苦恼了好久,今天想着去Animator里找找有木有可用的函数,妈蛋 一找就有收获!!! 原先是酱紫.头部是正常的角度. 加上以下代码便会有改变~~Surprise~~~!!!     private void OnAnimatorIK(int layerIndex)    {        float ang

Android学习分享:执行某ViewGroup的动画时,子控件太多导致动画执行卡顿的问题

最近在项目中遇到一个问题,我有一个LinearLayout,里面装载了许多ImageView控件,ImageView控件显示着自己的图片,这个LinearLayout支持双指缩放,缩放采用ScaleAnimation来实现,但是但是在缩放过程中,屏幕十分卡顿,缩放效果根本没有跟上手指的缩放动作.后来在Google上查了一番,查到一个API,叫setAnimationDrawCacheEnabled(boolean enabled): /** * Enables or disables the c

使用系统的某些block api(如UIView的block版本写动画时),是否也考虑循环引用问题?

系统的某些block api中,UIView的block版本写动画时不需要考虑,但也有一些api 需要考虑 以下这些使用方式不会引起循环引用的问题 [UIView animateWithDuration:duration animations:^ { [self.superview layoutIfNeeded]; }]; [[NSOperationQueue mainQueue] addOperationWithBlock:^ { self.someProperty = xyz; }]; [[

在ASP.NET MVC中使用NuGet添加SignalR类库之后,再次运行程序时,它出现了一个异常:

自从在ASP.NET MVC中使用NuGet添加SignalR类库之后,再次运行程序时,它出现了一个异常: Server Error in '/' Application. The following errors occurred while attempting to load the app.- No assembly found containing an OwinStartupAttribute.- No assembly found containing a Startup or [

运行sqlplus时遇到cannot restore segment prot after reloc: Permission denied

运行sqlplus时遇到cannot restore segment prot after reloc: Permission denied,网上说可以吧SELinux关掉,但是我看了下我的系统已经关掉了,具体是编辑/etc/sysconfig/selinux,把SELINUX=enforcing一行注释掉,然后新加入一行:SELINUX=disabled,但是我这样做了以后,问题依旧,后来高手告诉我执行如下命令就行:chcon -t texrel_shlib_t /opt/app/oracle

运行cmd时提示你可能没有适当的权限访问该项目

Windows无法访问指定设备.路径或文件.你可能没有适当的权限访问该项目. 方法/步骤 在C:\Windows\System32目录下中找到cmd.exe文件   右键点击 "属性"--->"安全"--> "高级"-->"继续"-->"添加"-->"选择主体"-->输入你现在使用的用户名-->单击检查名称-->确定-->确定--&g

eclipse中配置tomcat后,运行jsp时出现Server Tomcat v7.0 Server at localhost failed to start.

最近在进行jsp开发学习,在配置上还是遇到很多问题. 在连接好数据库后,写了第一个jsp测试页面,结果在运行eclipse中运行toamcat时出现了错误提示:Server Tomcat v7.0 Server at localhost failed to start. 在cmd中运行   java   //正常 在cmd中运行   javac    //正常 运行tomcat的bin文件下的startup正常启动,唯独在eclipse中出现Server Tomcat v7.0 Server a

java io流 运行错误时,保存异常到文件里面

java io流 运行错误时,保存异常到文件里面 下面这个实例,运行后,输入数字,为正确,如果输入字符串,则报错,保存错误信息 //运行错误时,保存异常到文件里面 //下面这个实例,运行后,输入数字,为正确,如果输入字符串,则报错,保存错误信息 import java.io.*; import java.util.*; public class Index{ public static void main(String[] args) throws Exception{ try{ //创建文件