2011-04-06 76 views
0

之间改变时,我有2次,其具有相同的尺寸,具有colourPreview设置为self.view的子视图。这是我用于显示动画的代码:UIViews不动画彼此

-(void)startEditingHexLabel { 
    [UIView animateWithDuration:0.3 
        animations:^{ 
         [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:hexTextView cache:YES]; 
         [colourPreview removeFromSuperview]; 
         [self.view addSubview:hexTextView]; 
         [self.view sendSubviewToBack:colourPreview]; 



        } 
        completion:^(BOOL finished){ 

         [hexText becomeFirstResponder]; 
        }]; 

} 

但它只是更改为新视图而没有转换。有任何想法吗?

回答

1

您是否尝试过使用transitionWithView:duration:options:animations:completion:(文档here)。看起来这是iOS 4.0+的首选。还有如何在这些文档使用它的一个例子。

如果你想使用你当前的方法,我认为forView[UIView setAnimationTransition:forView:cache:]需要是您想要动画的视图的超级视图。在你的情况,这看起来是self.view。全文档here

HTH