开发者

button inside table view cell shows highlighted state on tapping on cell

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开发者_JAVA百科 then this issue doesn't exists but i need pressed state of the button.

Please help me out.

Thanks in advance!

Vivek Dandage.


Try with setting the cell.selectionStyle to UITableCellSelectionStyleNone


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜