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

 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(, , , )]; NSString *soundButtonTitle = @"语音";
[soundButton setTitle:soundButtonTitle forState:UIControlStateNormal];
[soundButton setTitle:soundButtonTitle forState:UIControlStateSelected];
[soundButton setTitle:soundButtonTitle forState:UIControlStateHighlighted];
[soundButton setTitleEdgeInsets:UIEdgeInsetsMake(, , , )]; [myButton setTitleEdgeInsets:UIEdgeInsetsMake(, , , )]; 4个参数是上边界,左边界,下边界,右边界。
上一篇:csdn获得积分


下一篇:iOS开发富文本制作 图片和文字/NSMutableParagraphStyle/NSMutableAttributedString