iOS--UIButton图片在上,文字在下

UIButton正常情况下是图片在左,文字在右,调整一下位置变成图片在上,文字在下,这个比较常用

- (void)setup
{
    // 调整图片
    self.imageView.xm_x = 0;
    self.imageView.xm_y = 0;
    self.imageView.xm_width = self.xm_width;
    self.imageView.xm_height = self.imageView.xm_width;
    
    // 调整文字
    self.titleLabel.xm_x = 0;
    self.titleLabel.xm_y = self.imageView.xm_height;
    self.titleLabel.xm_width = self.xm_width;
    self.titleLabel.xm_height = self.xm_height - self.titleLabel.xm_y;
}
原文地址:https://www.cnblogs.com/zhangshan/p/5589615.html