UIButton实现左边文字,右边图片

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_28285625/article/details/88826976
	//要先设置图片
 	[self.btn setImage:btnImage forState:UIControlStateNormal];
    [self.btn setImage:btnImage forState:UIControlStateHighlighted];
    _btn.titleEdgeInsets = UIEdgeInsetsMake(0, -_btn.imageView.image.size.width, 0, _btn.imageView.image.size.width);
    _btn.imageEdgeInsets = UIEdgeInsetsMake(0, _btn.titleLabel.bounds.size.width, 0, -_btn.titleLabel.size.width);

猜你喜欢

转载自blog.csdn.net/qq_28285625/article/details/88826976
0条评论
添加一条新回复