1

我的 UIView 子类中有一个方法,它向 CATransition 添加了一个方法layer

- (void)animateWithDefaultTransition:(NSString *)transition duration:(CFTimeInterval)duration
{
    CATransition *animation = [CATransition animation];
    [animation setType:transition];
    [animation setDuration:duration];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
    [animation setSubtype:@"fromRight"];

    [zoomView setHidden:NO];
    [[self layer] addAnimation:animation forKey:nil];
}

我像这样从另一个类中调用它:

[transitionView animateWithDefaultTransition:@"push" duration:1.0];

然而zoomView只是出现并且不执行转换。

4

1 回答 1

0

尝试UIView过渡方法:

[UIView transitionWithView:containerView
       duration:0.2
       options:UIViewAnimationOptionTransitionFlipFromLeft
       animations:^{
         [fromView removeFromSuperview];
         [containerView addSubview:toView];
       }
       completion:NULL];
于 2012-03-03T08:50:11.593 回答