码迷,mamicode.com
首页 > 其他好文 > 详细

UIButton左边图片右边文字的做法

时间:2014-07-28 15:21:33      阅读:527      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   for   div   log   ui   图片   

 UIImage *yuyinImage = [UIImage imageNamed:@"yuyin.png"];
    [soundButton setImage:yuyinImage forState:UIControlStateNormal];
    [soundButton setImage:yuyinImage forState:UIControlStateSelected];
    [soundButton setImage:yuyinImage forState:UIControlStateHighlighted];
    //top left bottom right
    [soundButton setImageEdgeInsets:UIEdgeInsetsMake(5, 5, 5, 15)];

NSString *soundButtonTitle = @"语音";
    [soundButton setTitle:soundButtonTitle forState:UIControlStateNormal];
    [soundButton setTitle:soundButtonTitle forState:UIControlStateSelected];
    [soundButton setTitle:soundButtonTitle forState:UIControlStateHighlighted];
    [soundButton setTitleEdgeInsets:UIEdgeInsetsMake(5, 10, 5, 0)];

[myButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)]; 4个参数是上边界,左边界,下边界,右边界。

 

UIButton左边图片右边文字的做法,布布扣,bubuko.com

UIButton左边图片右边文字的做法

标签:style   blog   color   for   div   log   ui   图片   

原文地址:http://www.cnblogs.com/mgbert/p/3872866.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!