0

我使用下面的代码进行转换

CATransition *transition = [CATransition animation];
transition.duration = duration ;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

transition.type = kCATransitionMoveIn;

transitioning = YES;
transition.delegate = self;

[self.view.layer addAnimation:transition forKey:nil];


fromUIView.hidden = YES;
toUIView.hidden = NO;

UIImageView *tmp = toUIView;
toUIView = fromUIView;
toUIView = tmp;

但我希望在过渡进度 0.3 处暂停做某事,然后继续过渡到进度 0.6 做某事并继续。是否可以 ?

4

1 回答 1

0

我以前从未使用CATransition过,但我认为您可以使用NSTimer,GCDperformSelector:withObject:afterDelay:.

例如:

double delayInSeconds = 0.3;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
    [self doSomething];
});

doSomething在哪里

-(void)doSomething{
    [self pauseLayer:thisLayer];
    //do something
    [self resumeLayer:thisLayer];
}
于 2012-11-04T09:28:16.197 回答