Saturday, January 4, 2014

Prawns, how to modify the button's background?

Usually when a button is pressed, the button turns blue, blue to how to modify to make other colors?
Can you give a specific code, thank you!
Reply:
Kind of problem, if no api, succession uibutton, then re-write drawrect functions.
Reply:
 UIButton * button = [[UIButton alloc] initWithFrame: CGRectMake (0.0f, 0.0f, 300.0f, 233.0f)]; 
[Button setBackgroundImage: [[UIImage imageNamed: @ "test.png"] stretchableImageWithLeftCapWidth: 110.0 topCapHeight: 0.0] forState: UIControlStateNormal];
[Button setBackgroundImage: [[UIImage imageNamed: @ "test2.png"] stretchableImageWithLeftCapWidth: 110.0 topCapHeight: 0.0] forState: UIControlStateHighlighted];

Use the button to change the background image background replace
UIControlStateHighlighted press the button to display the picture .....
Reply:
Or add a button to get touchupinside action

Then modify the background of the action buttons inside

button.backgroundcolor = [UIColor yourcolor];
Reply:
reference to the third floor windows_star reply:
or to add a button to get touchupinside action

Then modify the background of the action buttons inside

button.backgroundcolor = [UIColor yourcolor];

This method does not work you ah!
Reply:
reference to the second floor cloudhsu reply:
C / C + + code
UIButton * button = [[UIButton alloc] initWithFrame: CGRectMake (0.0f, 0.0f, 300.0f, 233.0f)];
[Button setBackgroundImage: [[UIImage imageNamed: @ "test.png"] stretchableImageWithLeftCapWidth: 1 ......

Can you give a small example? I am stupid!

Reply:
references, 5th Floor kangqijun reply:
reference to the second floor cloudhsu reply:

C / C + + code
UIButton * button = [[UIButton alloc] initWithFrame: CGRectMake (0.0f, 0.0f, 300.0f, 233.0f)];
[Button setBackgroundImage: [[UIImage imageNamed: @ "test.png"] stretchabl ......

This is an example of a sweat .... ........
Reply:
reference to the 6th floor cloudhsu reply:
references, 5th Floor kangqijun reply:
References to the second floor cloudhsu reply:

C / C + + code
UIButton * button = [[UIButton alloc] initWithFrame: CGRectMake (0.0f, 0.0f, 300.0f, 233.0f)];
[Button setBackgroundImage: [[UIImage imageNamed ......

So now, I still did not realize, ah, brother ah!
This in the end is why ah!
Reply:
To modify very simple ah, ah RGB modification ...
Reply:
reference to the 8th floor qinqijing_123 reply:
To modify very simple ah, ah RGB modification ...

RGB is the thing?
Reply:
reference to the second floor cloudhsu reply:
C / C + + code
UIButton * button = [[UIButton alloc] initWithFrame: CGRectMake (0.0f, 0.0f, 300.0f, 233.0f)];
[Button setBackgroundImage: [[UIImage imageNamed: @ "test.png"] stretchableImageWithLeftCapWidth: 1 ......

Success in your code plus the sentence [self.view addSubview: button];?

Reply:
reference to the 10th floor kangqijun reply:
success in your code plus a sentence? [self.view addSubview: button];

Uh .... I always thought that you add yourself .....
This is the plus button or something else basic usage ..... Khan
Reply:
reference to the 11th floor cloudhsu reply:
reference to the 10th floor kangqijun reply:
Success in your code plus the sentence [self.view addSubview: button];?

Uh .... I always thought that you add yourself .....
This is coupled with the basic usage button or something else ..... Khan

Oh, I'm just getting started, know too little.
Learn from the older generation!

No comments:

Post a Comment