方法一:
CGFloatlabelWidth = [button.titleLabel.textsizeWithFont:button.titleLabel.font].width;
[buttonsetTitleEdgeInsets:UIEdgeInsetsMake(0, -image.size.width,0, image.size.width)];
[buttonsetImageEdgeInsets:UIEdgeInsetsMake(0, labelWidth,0, -labelWidth)];
方法二:
自定义CZTitleButton继承UIbutton,重写layoutSubviews方法(见如下代码):