开发者

Changing the 'grey' colour after while a button is pressed - Cocoa Touch iPhone

开发者 https://www.devze.com 2023-02-26 05:55 出处:网络
Hello In IB I\'ve used a rectangle button, once u press that button and hold, it goes a grey colour - I want to change that g开发者_开发知识库rey colour to an image i made.

Hello In IB I've used a rectangle button, once u press that button and hold, it goes a grey colour - I want to change that g开发者_开发知识库rey colour to an image i made.

So once the user touches the button, it goes to the image which I made

Thanks


Set the selected state image for the button to the image that you have created:

[self.btnMybutton setImage:[UIImage imageNamed:@"gray.png"] forState:UIControlStateSelected];


In Interface Builder you can set an image for each state of the button. Simply click where it says "Default State Configuration" in the inspector and select "Highlighted State Configuration". Set the image you want in the "Image" or "Background" field and the button will use that image when it's touched.

0

精彩评论

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