I am trying to put the background of a UITableViewCell on top before selection and reverse it after.

The reason is that there are Label and images which prevent the selection but it is working where this is nothing but the background.

I tried :

 cell.backgroundView.layer.zPosition=10;
 cell.layer.zPosition=10;

Unfortunately it is not working.

If anyone has an idea to solve this problem, I will really enjoy it.

Thank you in advance.

有帮助吗?

解决方案

I finally found a better way to do that.

I have completely disabled user interaction on every cells before selection. Like that, no need to put the background in the first z-Position.

I used the following method at the creation AND the didDeselectRowAtIndexPath method:

cell.cellView.userInteractionEnabled=NO;

I put YES on the didSelectRowAtIndexPath method. It works perfectly.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top