You can set selectedBackgroundView
on your cell.
Add background image to uitableviewcell and change color when select row
-
07-10-2022 - |
题
I set a background image to cell of uitableView using the following code in cellForRowAtIndexPath function:
UIImageView *av = [[UIImageView alloc] initWithFrame:CGRectMake(20, 20, 277, 58)];
av.backgroundColor = [UIColor clearColor];
av.opaque = NO;
av.image = [UIImage imageNamed:@"pattern_gray0.png"];
cell.backgroundView = av;
I want when user presses the row change the color of row to green color and keep the background image at the same line.
How can I do this? Thanks in advance.
解决方案
不隶属于 StackOverflow