Question

I have been to the following link:

How to programatically highlight a UIButton?

In first two lines of their code I found:

UIImage* normalImage = [_infoButton imageForState:UIControlStateNormal];<br>
UIImage* highlighted = [_infoButton imageForState:UIControlStateHighlighted];

It seems that they have used multiple images, for their infoButton. I have an application with many buttons, and every button has different images which makes my application very huge in size. If I make different images for normalState and highlightedState my App size goes to double. So, i need some ideas like blur, or size down of button or image, or alpha down, for my button image. I don't know the code and that's my question.

How to animate/highlight the button on tapped in iPhone?

Thanks in advance.

Was it helpful?

Solution

First, "very huge in size" is a relative thing. Is it over the 10 MB limit that prevents download through the network? If not, maybe you shouldn't worry about it.

Second, have you tried saving the images in a form with better compression, such as JPEG?

Third, are these "different images" substantially different, as in "In one state it looks like an elephant and in another state it looks like the Taj Mahal"? Or is it a matter of needing different "elephant states"? It sounds like the latter.

One possibility is to set some of the button's properties to activate different drawing behavior. Look at these two options:

button.reversesTitleShadowWhenHighlighted
button.adjustsImageWhenHighlighted 

or try varying

- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state; 

They have actually provided quite a few options.

OTHER TIPS

Ok ! I got one solution.

That is very much similar to my requirement. Yes, There may be other solutions,

i find which is nearer to my request.

select your UIButton in view & set Button Attributes

-> check mark on -> shows Touch on Highlight.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top