I used the code below to make transition
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;
but I hope to pause at transition progress 0.3 to do something, then resume the transition to progress 0.6 do something and resume. is it possible ?
I've never worked with CATransition
before, but I think you can do this with NSTimer
, GCD
, or performSelector:withObject:afterDelay:
.
For instance:
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];
});
where doSomething
is
-(void)doSomething{
[self pauseLayer:thisLayer];
//do something
[self resumeLayer:thisLayer];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.