Skip to content

Commit

Permalink
Fixed Tencent#580 去掉 QMUIButton setImage:forState: 里额外的 layout 触发,避免某…
Browse files Browse the repository at this point in the history
…些情况下的 crash
  • Loading branch information
MoLice committed May 7, 2019
1 parent c5a9bc1 commit 7a0dc24
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions QMUIKit/QMUIComponents/QMUIButton/QMUIButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,6 @@ - (void)setImage:(UIImage *)image forState:(UIControlState)state {
}

[super setImage:image forState:state];

// 注意,这句必须。因 UIButton 系统特性问题,如果在设置图片前就访问过 imageView,那么之后设置图片时 imageView.image 在布局的时候还会是 nil(self.currentImage 有值),这样会导致一些布局问题。解决方法是再触发一下 self.imageView。详情请看 https://github.com/Tencent/QMUI_iOS/issues/439
[self imageView];
}

- (void)tintColorDidChange {
Expand Down

0 comments on commit 7a0dc24

Please sign in to comment.