Iphone 在从视图转换期间缩放UIView?

Iphone 在从视图转换期间缩放UIView?,iphone,uiview,quartz-graphics,Iphone,Uiview,Quartz Graphics,我使用容器UIView来复制iTunes商店在点击相册插图时的行为,它会翻转和缩放 当前代码如下所示: //mainView is 300x300x, smallView is 30x30 [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:2.0]; [UIView transitionFromView:mainView toView:smallView duration:3.0 optio

我使用容器UIView来复制iTunes商店在点击相册插图时的行为,它会翻转和缩放

当前代码如下所示:

//mainView is 300x300x, smallView is 30x30      

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView transitionFromView:mainView toView:smallView duration:3.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];

containerView.frame = CGRectMake(275, 415, 30, 30);

[UIView commitAnimations];  

我似乎无法在动画期间缩放containerView的内容,帧只是靠近内容。我尝试将一些变换应用于视图、图层和其他一些东西,但似乎无法使其正常工作。

与其设置帧,不如尝试使用变换:

- (void)setStartTransform:(CGAffineTransform)transform;
- (void)setEndTransform:(CGAffineTransform)transform;
差不多

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView transitionFromView:mainView toView:smallView duration:3.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];

//containerView.frame = CGRectMake(275, 415, 30, 30);

[containerView setStartTransform: CGAffineTransformIdentity];
[containerView setEndTransform: CGAffineTransformMakeScale(0.1, 0.1)];

[UIView commitAnimations];  
(您可能还需要将转换应用于转换。)

尝试以下方法:

[UIView transitionWithView:mainView
           duration:0.2
           options:UIViewAnimationOptionTransitionFlipFromLeft
           animations:^{ 
              containerView.frame = CGRectMake(275, 415, 30, 30)
            }
           completion:NULL];

我自己也试过了,虽然缩放确实有效,但它仍然会设置动画,就好像帧正在靠近第一个视图一样(内容图像不随帧缩放)。还有其他解决方案吗?我也在尝试同样的事情,也在挣扎。