UIView TransitionFromView示例?

时间:2010-12-31 12:25:33

标签: iphone uiview transitions

我想使用UIView的transitionFromView方法为视图设置动画并在事件完成时捕获它。有些人可以发一个例子吗?

谢谢!

F。

1 个答案:

答案 0 :(得分:17)

-(IBAction) anAction:(id) sender {
    // assume view1 and view2 are some subviews of self.view
    // view1 will be replaced with view2 in the view hierarchy
    [UIView transitionFromView:view1 
                        toView:view2 
                      duration:0.5 
                       options:UIViewAnimationOptionTransitionFlipFromLeft   
                    completion:^(BOOL finished){
                        /* do something on animation completion */
                      }];
    }

}