Button的imageEdgeInsets和titleEdgeInsets属性

button中自带的title和image,给button设置这两个属性,默认是居中,UIEdgeInsetsMake(0, 0, 0, 0), imageEdgeInsets和titleEdgeInsets属性可以改变偏移量

button.imageEdgeInsets= UIEdgeInsetsMake(0, -40, 0, 0);
button.titleEdgeInsets = UIEdgeInsetsMake(0, -40, 0, 0);

向左偏移40

你可能感兴趣的:(Button的imageEdgeInsets和titleEdgeInsets属性)