對網(wǎng)上的其他方法略有修改
圖片在上洲赵,文字在下
- (void)changeButtonType:(UIButton *)button {
CGFloat interval = 1.0;
CGSize imageSize = button.imageView.bounds.size;
[button setTitleEdgeInsets:UIEdgeInsetsMake(imageSize.height + interval, -(imageSize.width), 0, 0)];
CGSize titleSize = button.titleLabel.bounds.size;
[button setImageEdgeInsets:UIEdgeInsetsMake(0,0, titleSize.height + interval, -(titleSize.width))];
}
如果是masonry布局筷屡,可放在布局以后在調(diào)用