Init对象在 - (void)方法中

时间:2015-06-24 03:31:02

标签: ios objective-c

我有两个视图控制器类,classAclassBclassA的子类。

classA中,我编写了一个方法startAnimation,可以显示ActivityIndicator之类的视图;

我尝试通过调用-(void)startAnimationclassB中使用[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;
}

0 个答案:

没有答案