Question

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.

Was it helpful?

Solution

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.

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