我有一个UIImageView
动画,我有一个启动或停止动画的功能。从另一个UIView
类中我调用该函数,该函数被调用并且if statements
工作,但不是 startAnimation。
这是启动或停止动画的函数:
-(void)runPlayerAnimation:(BOOL)run {
if (run) [player startAnimating];
else [player stopAnimating];
}
这是从类中调用函数的函数UIView
:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
CGPoint point = [[touches anyObject] locationInView:self];
if ([self pointInCircle:point]) {
[self touchesMoved:touches withEvent:event];
GameplayVC *a = [[GameplayVC alloc] init];
[a runPlayerAnimation:YES];
}
}
两个类都像这样相互导入。在头文件@class
中使用a,在实现文件#import
中使用。
我已经NSLogged
摆脱了这个功能,一切都在工作,除了startAnimating
和可能stopAnimating
也是。