【发布时间】:2009-07-20 07:03:39
【问题描述】:
#import "MyViewController.h"
@implementation MyViewController
@synthesize menuView, gameView, helpView, optionsView, gameButton, helpButton, optionsButton;
- (void) viewDidLoad {
[self setView:menuView];
}
- (IBAction)gotoGame {
[UIView beginAnimations:@"buttonSlide" context: nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationDidStopSelector:@selector(animationDidStop)];
gameButton.center = CGPointMake(104,1000);
[UIView commitAnimations];
}
- (IBAction)gotoHelp {
[self setView:helpView];
}
- (IBAction)gotoOptions {
[self setView:optionsView];
}
- (void)animationDidStop {
NSLog(@"why is this not working?");
[self setView:gameView];
}
@end
不确定什么会有帮助,所以我包含了整个 .m 文件。无论如何,我是 iPhone 应用程序开发的新手,我正在努力完成我的动画。动画本身完美运行,但方法 animationDidStop 拒绝被调用..即使我使用 setAnimationDidStopSelector 就像它在文档中显示的那样。我知道视图更改有效,因为当我将它放在 gotoGame {} 中的动画之后时,它会切换,但这会导致动画不显示。
有人可以帮我在动画停止后调用该方法,还是使用计时器在必要的时间后调用它? (我也尝试过这种方法,但没有运气)。
【问题讨论】:
-
没关系,我错过了:[UIView setAnimationDelegate:self];
-
您应该将其发布为答案并接受它。
标签: iphone objective-c cocoa cocoa-touch animation