New*_*bee 4 iphone xcode objective-c ios
动画结束后,我想做一些动作.
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.80f];
self.view.transform =
CGAffineTransformMakeTranslation(
self.view.frame.origin.x,
480.0f + (self.view.frame.size.height/2) // move the whole view offscreen
);
[self.view setAlpha:0];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
我已经完成了上面的动画,如何找到动画结束,以便我可以在那之后做我的动作.
用这个:
[UIView animateWithDuration:0.80f animations:^{
self.view.transform =
CGAffineTransformMakeTranslation(
self.view.frame.origin.x,
480.0f + (self.view.frame.size.height/2) // move the whole view offscreen
);
[self.view setAlpha:0];
}
completion:^(BOOL finished){
// your code
}];
Run Code Online (Sandbox Code Playgroud)
将其添加到动画中:
[UIView setAnimationDidStopSelector:@selector(myAnimationEnded)];
[UIView setAnimationDelegate:self];
Run Code Online (Sandbox Code Playgroud)
这个方法会告诉你何时停止;
- (void)myAnimationEnded{
NSLog(@"animation ended");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3783 次 |
| 最近记录: |