///调整按钮为上图片下文字
+ (void)adjustButtonImageViewUPTitleDownWithButton:(UIButton *)button withSpace:(CGFloat)space {
[button.superview layoutIfNeeded];
[button setTitleEdgeInsets:UIEdgeInsetsMake(button.imageView.frame.size.height+space ,-button.imageView.frame.size.width, 0.0,0.0)];//文字距离上边框的距离增加imageView的高度,距离左边框减少imageView的宽度,距离下边框和右边框距离不变
[button setImageEdgeInsets:UIEdgeInsetsMake(-button.titleLabel. intrinsicContentSize.height,(button.frame.size.width-button.imageView.bounds.size.width)/2.0,0.0,(button.frame.size.width-button.imageView.bounds.size.width)/2.0)];
}
网友评论