【发布时间】:2015-04-21 11:20:53
【问题描述】:
我们是否需要在 UIAnimation 块中使用 __weak self ,如下所示?如果我们不将 self 指定为弱,是否会产生保留周期问题?
[UIView animateWithDuration:animationDuration
delay:0
options:UIViewAnimationCurveEaseInOut
animations:^{
[self doSomething];
} completion:^(BOOL finished) {
if (finished) {
[self doSomething];
}
}];
我也对以下情况感到困惑。对此有什么想法吗?请分享您的 cmets。
[self.navController dismissViewControllerAnimated:animated
completion:^{
[self doSomething];
}];
我们应该在这里使用弱自我吗?
【问题讨论】:
-
谢谢大家,我越来越清楚了。我也想讨论以下案例。 [self.navControllerdismissViewControllerAnimated:动画完成:^{ [self doSomething]; }];
标签: ios automatic-ref-counting objective-c-blocks retain-cycle