如何使用浮雕背景图像制作UIButton?

时间:2013-05-29 08:29:12

标签: ios objective-c ipad uibutton

这是按钮对iPad Safari的影响:
iPad Safari

现在我只有那样的图标文件:
action icon

如何以编程方式将带有图标图像的UIButton作为背景显示为Safari上的iPad

非常感谢!

2 个答案:

答案 0 :(得分:0)

UIImage *buttonImage = [UIImage imageNamed:@"imageName.png"];
[btn setImage:buttonImage forState:UIControlStateNormal];
[self.view addSubview:btn];

尝试这个..

答案 1 :(得分:-1)

UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
[button setFrame:CGRectMake(0, 0, 150, 30)];
[button setBackgroundImage:[UIImage imageNamed:@"bg.png"] forState:UIControlStateNormal];
[button setImage:[UIImage imageNamed:@"ar.png"] forState:UIControlStateNormal];

bg.png bg.png

ar.png ar.png