我的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
,并且不会执行转换。
答案 0 :(得分:0)
尝试UIView
转换方法:
[UIView transitionWithView:containerView
duration:0.2
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[fromView removeFromSuperview];
[containerView addSubview:toView];
}
completion:NULL];