可以先设置居左、居中、居右,然后再调节具体值。
searchButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
searchButton.contentEdgeInsets = UIEdgeInsetsMake(0,10,0,0);
searchButton.imageEdgeInsets = UIEdgeInsetsMake(0,10,0,0);
可以先设置居左、居中、居右,然后再调节具体值。
searchButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
searchButton.contentEdgeInsets = UIEdgeInsetsMake(0,10,0,0);
searchButton.imageEdgeInsets = UIEdgeInsetsMake(0,10,0,0);