我有两个视图控制器类,classA
和classB
是classA
的子类。
在classA
中,我编写了一个方法startAnimation
,可以显示ActivityIndicator
之类的视图;
我尝试通过调用-(void)startAnimation
在classB
中使用[self startAnimation]
,但效果不佳,但更改为-(BOOL)startAnimation
效果很好。我还没有明白。请为我解释一下:
-(BOOL)startAnimation{
__block bool a = NO;
_displayViewForActivityIndicator = [[ProcessingIndicationView alloc] initWithFrame:CGRectMake(-self.view.frame.size.width, -self.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height)];
[self.view addSubview:_displayViewForActivityIndicator];
LogDebug(@"Start the method");
[UIView animateWithDuration:1.0f
delay:0.0f
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
//end position:
_displayViewForActivityIndicator.frame = self.view.frame;
}
completion:^(BOOL finished) {
if (finished) {
LogDebug(@"Finish animation");
}
a = YES;
}];
return a;
}