0

我有一个我制作的时钟的单独横向视图,我希望它在手机旋转到横向时交叉溶解,然后在它返回纵向时交叉溶解,但是当我以不同的方式尝试这个时,我一直有问题。

关于如何做到这一点的建议?

4

1 回答 1

1

添加两个单独的视图作为视图控制器主视图的子视图。

实施:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

在您的视图控制器中,添加这样的代码来处理交叉溶解:

[UIView beginAnimations: @"cross dissovle" context: NULL];
[UIView setAnimationDuration: 1.0f];
self.firstView.alpha = 0.0f;
self.secondView.alpha = 1.0f;
[UIView commitAnimations];

显然,您需要实现另一种情况并在其周围加上一些逻辑,但这留给读者作为练习;-)。

于 2011-01-05T09:01:32.470 回答