标签:
在block中常常会用到self,可是会造成循环引用。这时候就需要这样来解决这个问题:
#define WeakSelf __weak __typeof(self) weakSelf = self #define StrongSelf __strong __typeof(weakSelf) self = weakSelf
- (void)aFunc:(id)sender { WeakSelf;//1 [UIView animateWithDuration:1 animations:^{ StrongSelf;//2 [self.view doSomething];//use self }]; }
标签:
原文地址:http://www.cnblogs.com/ficow/p/5395512.html