UITableViewCell selected row's text color change

后端 未结 4 969
再見小時候
再見小時候 2021-01-30 12:47

I am having a tableview and I want to know that how can I change the selected row\'s text color, say to Red ? I tried by this code :

- (UITableViewCell *)tableV         


        
4条回答
  •  有刺的猬
    2021-01-30 13:02

    If you want to change the text colour only, with out changing cell background colour. you can use this.Write this code in in cellForRowAtIndexPath method

    UIView *selectionColor = [[UIView alloc] init];
    selectionColor.backgroundColor = [UIColor clearColor];
    cell.selectedBackgroundView = selectionColor;
    cell.textLabel.highlightedTextColor = [UIColor redColor];
    

提交回复
热议问题