首页 > IT职业 > IT职场 > MG--Swift3.0之仿写酷狗音乐的索引

@available(iOS 3.0, *)
open func reloadSectionIndexTitles() // reloads the index bar.
// 重新刷新右边文字
@available(iOS 6.0, *)
open var sectionIndexColor: UIColor? // color used for text of the section index
// 右边文字的颜色
@available(iOS 7.0, *)
open var sectionIndexBackgroundColor: UIColor? // the background color of the section index while not being touched
// 设置右边的View背景颜色
@available(iOS 2.0, *)
optional public func sectionIndexTitles(for tableView: UITableView) -> [String]? // return list of section titles to display in section index view (e.g. "ABCD...Z#")
// 返回?右边的显示文字 (是一个数组)
@available(iOS 2.0, *)
optional public func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int // tell table which section corresponds to section title/index (e.g. "B",1))
// 设置选中右边的某个文字时的方法,参数1是tableVie,参数2是选中的文字,参数3是选中的文字对应数组中的索引
有细心的小伙伴说:“UITableView滚动的时候,右边相应的索引没有跟着改变”?,于是加了下班,有了这个效果


Demo链接: https://pan.baidu.com/s/1cEfBaQ 密码: 5r3d
应小伙伴需要:
OC版tableView索引仿写链接: https://pan.baidu.com/s/1kVBgAxD 密码: 1hmk
轻轻点击,关注我
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2388/viewspace-2822979/ ,如需转载,请注明出处,否则将追究法律责任。