仅是自己的理解 不保证正确 严谨性
需要 _weak typeof(self) weakSelf = self
例子
@interface GoodsDetailController ()
@property(strong,nonatomic) UILabel *testBlockLabel;
@property(strong,nonatomic) NSString *daCai;
@end
@implementation GoodsDetailController
- (void)viewDidLoad {
self.view.backgroundColor = [UIColor redColor];
self.testBlockLabel = [UILabel newAutoLayoutView];
[self.view addSubview:self.testBlockLabel ]; //这里 对label进行了引用
self.testBlockLabel .text = @"dddddddddddd";
[self.testBlockLabel autoCenterInSuperview];
__weak typeof(self) weakSelf = self;
// addTapActionWithBlock (https://github.com/shaojiankui/iOS-Categories) 这里有很多好用的东西
[self.testBlockLabel addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
self.daCai =@"这里会有警告";
weakSelf.daCai =@"这样就没有问题";
}];
}
- (void)dealloc {
NSLog(@"赵大财");
}