对网上的其他方法略有修改
图片在上,文字在下
- (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布局,可放在布局以后在调用
网友评论