Sle*_*lee 13 objective-c uiview iphone-sdk-3.0 ios
动画完成后,我可以设置要调用的函数吗?我想淡化a UIView然后将其从中移除superView.
SK9*_*SK9 37
动画块在iOS4中引入.Apple建议您使用这些,并且新方法主要要求替换回调的完成块.例如:
[UIView animateWithDuration:0.5f
delay:0.0f
options:UIViewAnimationCurveEaseInOut
animations:^{
[myView setAlpha:0.0f];
}
completion:^(BOOL finished) {
[myView removeFromSuperview];
}];
Run Code Online (Sandbox Code Playgroud)
Eik*_*iko 25
是的,这很简单:
配置动画时
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(myAnimationStopped:finished:context:)];
Run Code Online (Sandbox Code Playgroud)
并定义您的方法,如:
-(void)myAnimationStopped:(NSString *)animationID
finished:(NSNumber *)finished
context:(void *)context {
// fancy code here
}
Run Code Online (Sandbox Code Playgroud)
self当然,不一定是那种方法.
| 归档时间: |
|
| 查看次数: |
14415 次 |
| 最近记录: |