給UIButton添加背景圖片
//定義一個(gè)button
UIButton * button = [UIButton buttonWithType:(UIButtonTypeRoundedRect)];
//大小
button.frame =CGRectMake(10, 10, 50, 50);
//設(shè)置成圓形(根據(jù)需要)
button.layer.cornerRadius = button.frame.size.width /2;
button.clipsToBounds = YES;
//調(diào)用添加圖片的方法
[button setBackgroundImage:[UIImage imageNamed:@"add.png"] forState:(UIControlStateNormal)];
[self.view addSubview:button];