if (!self.lastRefreshButton) {
UIButton *lastRefreshButton = [UIButton buttonWithType:UIButtonTypeCustom];
lastRefreshButton.backgroundColor = [UIColor whiteColor];
[lastRefreshButton addTarget:self action:@selector(clickReloadCardView) forControlEvents:UIControlEventTouchUpInside];
[lastRefreshButton setBackgroundImage:[UIImage imageNamed:@"fx_brands_prompt"] forState:UIControlStateNormal];
lastRefreshButton.size = swipeableView.containerView.size;
[swipeableView.containerView addSubview:lastRefreshButton];
self.lastRefreshButton = lastRefreshButton;
}
如果對(duì)一個(gè)button進(jìn)行懶加載添加到view上,會(huì)有控制器和button的superview對(duì)其進(jìn)行強(qiáng)引用,如果從其父視圖刪除,button不會(huì)為空,因?yàn)橛锌刂破鲗?duì)其進(jìn)行強(qiáng)引用,這時(shí)候就不會(huì)調(diào)用重新創(chuàng)建,導(dǎo)致的問(wèn)題就是不能進(jìn)行響應(yīng)事件,但是如果設(shè)置button的lastRefreshButton.userInteractionEnabled就可以再次進(jìn)行響應(yīng)事件,具體原因不明