TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
Customize table view cell border and highlight colors.
Only supports UITableViewStylePlain
1) Subclass StyledTableViewCell
2) Set UITableView separator to none to hide the default separator
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
3) Use setDashWidth:dashGap:dashStroke: to configure custom cell separators
e.g. dashes for separators
[self setDashWidth:5 dashGap:3 dashStroke:1];
e.g. dotted-lines for separators
[self setDashWidth:1 dashGap:3 dashStroke:1];
4) Set UITableView separator color to set the custom separator color
[self.tableView setSeparatorColor:[UIColor colorWithWhite:0.7 alpha:1]];
5) Use setStyledTableViewCellSelectionStyle: to set background colors of cell when selected, using preset colors
[self setStyledTableViewCellSelectionStyle:StyledTableViewCellSelectionStylePurple];
6) Use setSelectedBackgroundGradientColors: to set background colors of cell when selected, using custom gradients
e.g. gradient of 2 colors
NSMutableArray *colors = [NSMutableArray array];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:234/255.0 blue:0 alpha:1] CGColor]];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:174/255.0 blue:0 alpha:1] CGColor]];
[self setSelectedBackgroundViewGradientColors:colors];
e.g. gradient of 3 colors
NSMutableArray *colors = [NSMutableArray array];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:174/255.0 blue:0 alpha:1] CGColor]];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:234/255.0 blue:0 alpha:1] CGColor]];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:174/255.0 blue:0 alpha:1] CGColor]];
[self setSelectedBackgroundViewGradientColors:colors];
7) Use setSelectionGradientDirection: to set direction of gradient when cell is selected
e.g. horizontal gradient
[self setSelectionGradientDirection:StyledTableViewCellSelectionGradientDirectionHorizontal];
e.g. diagonally from bottom left to top right
[self setSelectionGradientDirection:StyledTableViewCellSelectionGradientDirectionDiagonalBottomLeftToTopRight];
e.g. diagonally from top left to bottom right
[self setSelectionGradientDirection:StyledTableViewCellSelectionGradientDirectionDiagonalTopLeftToBottomRight];
Only supports UITableViewStylePlain.