UIButton *testButton = [[UIButton alloc] init];
[self.view addSubview:testButton];
testButton.backgroundColor = [UIColor redColor];
[testButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(@100);
make.height.equalTo(@100);
make.left.equalTo(self.view.mas_left);
make.top.equalTo(self.view.mas_top);
}];
[testButton bk_addEventHandler:^(id sender) {
[self dismissViewControllerAnimated:YES completion:nil];
} forControlEvents:UIControlEventTouchUpInside];
I use both BlocksKit and Masonry in my code. If use I BlocksKit, bk_addEventHandler
, there is a retain cycle, which I think it is because self retain self.view, retain testButton, retain self. However, when I use Mansonry alone without BlocksKit, and I use strong self in Masonry mas_makeConstraints
, it occurs to me that there is no retain cycle because the viewController can invoke dealloc method. Can anyone explain to me that there is no retain cycle in Masonry?