Ian*_*ell 5 iphone cocoa-touch uitableview uiview
我有一个UIView作为UITableViewCell的自定义子类的子视图.我用它来动态地改变单元格的一小块区域的颜色.
当我选择单元格时,整个单元格的背景颜色(包括子视图的背景颜色)将更改为蓝色.那很好,它瞬间发生.选择向下钻到另一个视图控制器.
但是,当我从视图控制器返回时,它会再次将背景从蓝色变为白色 - 但它不会为我的子视图的背景颜色设置动画.效果是蓝色动画为白色,然后突然变回我原来的颜色.
我该怎么做
谢谢!
下面显示了如何设置颜色变化的动画:
UIView * blue = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 300, 20)];
[self.view addSubview:blue];
blue.backgroundColor = [UIColor whiteColor];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
blue.backgroundColor = [UIColor blueColor];
[UIView commitAnimations];
[blue release];
Run Code Online (Sandbox Code Playgroud)
希望您可以对其进行调整以满足您的需求。
汤姆
| 归档时间: |
|
| 查看次数: |
2422 次 |
| 最近记录: |