美文网首页IOS
设置UIButton的文左图右

设置UIButton的文左图右

作者: 508e0be44880 | 来源:发表于2016-12-01 16:40 被阅读76次

设置UIButton的文左图右

[btn.imageViewsetContentMode:UIViewContentModeScaleAspectFit];

//交换button中title和image的位置

CGFloatlabelWidth = btn.titleLabel.frame.size.width;

CGFloatimageWith = btn.imageView.frame.size.width;

btn.imageEdgeInsets=UIEdgeInsetsMake(0, labelWidth,0, -labelWidth);

btn.titleEdgeInsets=UIEdgeInsetsMake(0, -imageWith,0, imageWith);

相关文章

网友评论

    本文标题:设置UIButton的文左图右

    本文链接:https://www.haomeiwen.com/subject/fxoxmttx.html