UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(200, 200, 150, 60)];
btn.layer.borderWidth = 1;
btn.layer.borderColor = [UIColor darkGrayColor].CGColor;
[self.view addSubview:btn];
[btn setImage:[UIImage imageNamed:@"img"] forState:UIControlStateNormal];
[btn setTitle:@"位置测试" forState:UIControlStateNormal];
[btn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
1.不设置button的UIEdgeInsetsMake,默认位置
2.设置图片右距离
[btn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 20)];
3.设置图片左距离