Sunday, December 8, 2013

Change button background image how to press the button after neighborhoods

Such as the title, how to change neighborhoods button after pressing the button background image, I set up a method for press, but could not find which method is to change the button background image, as well as how to Resouce pictures assigned to another parameters, it is best to give code examples ah, thank you
- (IBAction) buttonDown: (id) sender {
self.tButton.backgroundColor = [UIColor redColor];

}
This is a change of color, change the background image of how to write it?
Reply:
Hyperlinks how other neighborhoods, said
Reply:
? UIImage * newImage = (checked) [UIImage imageNamed: @ "red.png"]: [UIImage imageNamed: @ "green.png"];
[Button setBackgroundImage: newImage forState: UIControlStateNormal];

So add a checked BOOL type variables also facilitate you in exchange for going


Reply:
Good to see the next document. . There are state property. . . . Have the effect of setting the picture according to the different states. .
Reply:
The New hand
Reply:
reference to the second floor yiyaaixuexi reply:
UIImage * newImage = (checked)? [UIImage imageNamed: @ "red.png"]: [UIImage imageNamed: @ "green.png"];
[Button setBackgroundImage: newImage forState: UIControlStateNormal];

So add a checked BOOL type variables also facilitate you in exchange for ......
Thank you've somehow
Reply:
reference to the third floor zhh107 reply:
a good look at the next document. . There are state property. . . . Have the effect of setting the picture according to the different states. .
Where can I see the document does not find ah, you like the API, this much-needed
Reply:
references, 4th Floor newlcc reply:
new new hands
No way, ah, just started a few days
Reply:
reference to the 6th floor hypercode reply:
reference to the third floor zhh107 reply:
Good to see the next document. . There are state property. . . . Have the effect of setting the picture according to the different states. .
Where can I see the document does not find ah, you like the API, in urgent need of this

Then you go to check the development process. Is api. Xcode inside the top right corner of your document. Or read the book to find the base. . Or look under the code. Or hold down the command-click UIButton document of this type can jump inside.

No comments:

Post a Comment