iOS settings of color when selected UITableViewCell

1. The system default color settings

1 //无色  
2 cell.selectionStyle = UITableViewCellSelectionStyleNone;  
3  
4 //蓝色  
5 cell.selectionStyle = UITableViewCellSelectionStyleBlue;  
6  
7 //灰色  
8 cell.selectionStyle = UITableViewCellSelectionStyleGray;   

2. custom colors and background settings

. 1 UIColor * Color = [[UIColoralloc] initWithRed: 0 .0green: 0 .0blue: 0 .0alpha: . 1 ]; // to define their own color by the RGB  
2 cell.selectedBackgroundView =  [[[the UIView the alloc] the initWithFrame: Cell. Frame] the autorelease];  
 . 3 cell.selectedBackgroundView.backgroundColor = [UIColor xxxxxx];   

3. Custom UITableViewCell when selected background

1 cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellart.png"]] autorelease];  
2 还有字体颜色  
3 cell.textLabel.highlightedTextColor = [UIColor xxxcolor]; [cell.textLabel setTextColor:color]  

 

Transfer: https: //blog.csdn.net/u011545929/article/details/14524147

Guess you like

Origin www.cnblogs.com/luoluosha/p/11694414.html