我的 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
只是出现并且不执行转换。