背景图的按钮

UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];

[rightButton setBackgroundImage:[UIImage imageNamed:@"bgbtn.png"] forState:UIControlStateNormal];

[rightButton setTitle:@"完成" forState:UIControlStateNormal];

[rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

rightButton.titleLabel.font = [UIFont boldSystemFontOfSize:12];

rightButton.frame = CGRectMake(265, 6.0, 40.0, 30.0);

[rightButton addTarget:self action:@selector(GetCarLocation) forControlEvents:UIControlEventTouchUpInside];

原文地址:https://www.cnblogs.com/zzxap/p/2175606.html