Iphone 将图像组合成一个UIButton?
如果我有一个png,它基本上是一个没有任何内容的按钮图像:Iphone 将图像组合成一个UIButton?,iphone,objective-c,ios,uiimageview,uibutton,Iphone,Objective C,Ios,Uiimageview,Uibutton,如果我有一个png,它基本上是一个没有任何内容的按钮图像: ---------------- | | ---------------- 我如何在上面放置图像,使图像成为按钮的一部分,如: ---------------- | (image) | ---------------- (我可以在顶部放置一个UIImageView,但它不会继承按钮属性,比如按下时变暗)使用基本上是按钮的图像作为UIButton的背景图像,并使用另一个图像作为UIButton的图像
----------------
| |
----------------
我如何在上面放置图像,使图像成为按钮的一部分,如:
----------------
| (image) |
----------------
(我可以在顶部放置一个UIImageView,但它不会继承按钮属性,比如按下时变暗)使用基本上是按钮的图像作为UIButton的背景图像,并使用另一个图像作为UIButton的图像
[button setImage:[UIImage imageNamed:@"Foo"] forState:UIControlStateNormal];
[button setBackgroundImage:[UIImage imageNamed:@"Bar"] forState:UIControlStateNormal];
使用基本上是按钮的图像作为UIButton的背景图像,并使用其他图像作为UIButton的图像
[button setImage:[UIImage imageNamed:@"Foo"] forState:UIControlStateNormal];
[button setBackgroundImage:[UIImage imageNamed:@"Bar"] forState:UIControlStateNormal];