1
votes

I have an issue with the background image of button which is dependent of button state. I have a button inside customized table view cell and i have set different images for button's different states. Please look into the code below.

[btnNow setImage:[UIImage imageNamed:@"now_norm.png"] forState:UIControlStateNormal]; [btnNow setImage:[UIImage imageNamed:@"now_focus.png"] forState:UIControlStateHighlighted];

Whenever i tap on the actual button this works great but if i tap on area outside of button but which is still inside that same cell then this button changes its background image from UIControlStateNormal to UIControlStateHighlighted.

If i remove background image from UIControlStateHighlighted state then this issue doesn't exists but i need pressed state of the button.

Please help me out.

Thanks in advance!

Vivek Dandage.

2
Is this Java Swing or what is it?Jonas
UITableViewCell is iPhone. Java doesn't run on iPhone, so it certainly isn't Swing.Paul Lynch
It isn't a java Swing. I have used objective c for iphone application development.Rockey

2 Answers

2
votes

Try with setting the cell.selectionStyle to UITableCellSelectionStyleNone

0
votes

I wonder how to comment on karim's Answer. But that should be marked as right. It is the answer to the problem. I know, because I was having the same problem and setting the selectionStyle of the cell to None was the solution.