[CPP]View
Plaincopy
- 1. default color settings
[CPP]View
Plaincopy
- // Colorless
- Cell. selectionstyle = uitableviewcellselectionstylenone;
- // Blue
- Cell. selectionstyle = uitableviewcellselectionstyleblue;
- // Gray
- Cell. selectionstyle = uitableviewcellselectionstylegray;
2. Custom color and background settings
Change the background color when uitableviewcell is selected:
Uicolor * color = [[uicoloralloc] initwithred: 0.0 Green: 0.0 Blue: 0.0 ALPHA: 1];// Use RGB to define your own color
[HTML]View
Plaincopy
- Cell. selectedbackgroundview = [[[uiview alloc] initwithframe: cell. Frame] autorelease];
- Cell. selectedbackgroundview. backgroundcolor = [uicolor xxxxxx];
3. Custom background when uitableviewcell is selected
[HTML]View
Plaincopy
- Cell. selectedbackgroundview = [[[uiimageview alloc] initwithimage: [uiimage imagenamed: @ "cellart.png"] autorelease];
- Font color
- Cell. textlabel. highlightedtextcolor = [uicolor xxxcolor]; [cell. textlabel settextcolor: Color]; // set the font color of the cell.
4. Set the color of the split line between tableviewcells.
[Thetableview setseparatorcolor: [uicolor XXXX];
5. Set the font color in the cell.
// Customize the appearance of table view cells.- (UITableViewCell *)tableView UITableView *)tableView cellForRowAtIndexPath NSIndexPath *)indexPath{ if(0 == indexPath.row) { cell.textLabel.textColor = ...; cell.textLabel.highlightedTextColor = ...; } ...}
Reprinted: http://blog.csdn.net/a6472953/article/details/7532212