2017-06-06 123 views
0

TableView如何更改iOS TableView索引顏色?

如何自定義右側列表的顏色和字體。

+0

https://stackoverflow.com/questions/8971196/how-to-change-color-of-letters-of-sectionindextitlesfortableview檢查此 – vaibby

+0

https://stackoverflow.com/questions/13274562/customising-the-font- background-color-of-index-section-bar-in-uitableview – 2017-06-06 07:07:14

回答

4

使用UITableView方法sectionIndexColorsectionIndexBackgroundColor

tableView.sectionIndexColor = UIColor.red 
tableView.sectionIndexBackgroundColor = UIColor.clear 
+0

如何更改字體? – iMuzahid

+0

看到這個https://stackoverflow.com/a/758798/1825618 – Bilal

+0

兄弟,你保存了一天。 –

1

只要你可以訪問sectionIndexColor方法的UITableView

yourTableviewName.sectionIndexColor = UIColor.yourDesiredColor 
yourTableviewName.sectionIndexColor = UIColor.red // as Example i have used red color