1. 程式人生 > >修改tableView側欄索引的背景色

修改tableView側欄索引的背景色

tableView側欄索引的背景色預設是白色,但是可以通過以下屬性修改

1.修改index文字顏色

@property (nonatomic, strong, nullable) UIColor *sectionIndexColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;                   // color used for text of the section index

2.修改背景色

@property (nonatomic, strong, nullable) UIColor *sectionIndexBackgroundColor

NS_AVAILABLE_IOS(7_0) UI_APPEARANCE_SELECTOR;         // the background color of the section index while not being touched

3.修改點選後的背景色

@property (nonatomic, strong, nullable) UIColor *sectionIndexTrackingBackgroundColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; // the background color of the section index while it is being touched


例如:

//將背景色改為透明

_historyPropertyTableView.sectionIndexBackgroundColor = [UIColorclearColor];