开发者

iOS - Custom Button With A Depressed State

I realize that there has to be a a ton of guides to do this but I can't find it...

What I am trying to do is use a button with a custom image in it and when you press the button hav开发者_开发问答e the image change to another "pressed" version of the button.


If you don't like James Webster's solution, you can also do the same through interface builder. Select your button and from the properties find the "state config" list and pick "Selected". Then if you set image, title etc, you will get different graphics and text if you do [button setSelected:YES];


What I believe you need is:

[button setImage:image forState:UIControlStateSelected];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜