美文网首页
iOS 调整button中的图片位置

iOS 调整button中的图片位置

作者: 巴赫海兹 | 来源:发表于2018-09-26 10:16 被阅读259次

调整button中的图片位置

self.leftBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 80, 50)];  

[self.leftBtn setImage:[UIImage imageNamed:@"go_there"] forState:UIControlStateNormal];  

<span style="color:#ff0000;">[self.leftBtn setImageEdgeInsets:UIEdgeInsetsMake(4, 0, 4, 0)];//调整图片大小5:2</span> 


调整title的位置

button.titleEdgeInsets = UIEdgeInsetsMake(<#CGFloat top#>, <#CGFloat left#>, <#CGFloat bottom#>, <#CGFloat right#>);

相关文章

网友评论

      本文标题:iOS 调整button中的图片位置

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