相关疑难解决方法(0)

我们是否需要在ARC的UIAnimationBlocks中使用__weak self?

我们是否需要在UIAnimation块中使用__weak self,如下所示?如果我们不指定自我弱,是否会产生保留周期问题?

[UIView animateWithDuration:animationDuration 
                      delay:0 
                    options:UIViewAnimationCurveEaseInOut 
                 animations:^{
        [self doSomething];
    } completion:^(BOOL finished) {
        if (finished) {
            [self doSomething];
        }
    }];
Run Code Online (Sandbox Code Playgroud)

我也对以下场景感到困惑.有什么想法吗?请分享您的意见.

[self.navController dismissViewControllerAnimated:animated 
                                       completion:^{
                                                      [self doSomething];
                                                  }];
Run Code Online (Sandbox Code Playgroud)

我们应该在这里使用弱者吗?

ios objective-c-blocks automatic-ref-counting retain-cycle

21
推荐指数
2
解决办法
1万
查看次数