-
首先来看看酷狗的截图效果
-
酷狗音乐列表图.jpg
@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是选中的文字对应数组中的索引 ```
***
>- #最简单的仿写,嘿嘿😋,不确定有木有隐藏BUG
- ###自定义一个MGIndexView代替系统的
- ###仿写效果:
- #####仿写初衷:就是中间的提示文字,系统自带的没有这个效果。就是说当触摸点离开右边字母索引条的时候,没有提供API接口给我们,告诉我们什么时候该让中间的提示Label消失。而且系统自带的索引选中的时候不能设置选中的颜色,也没有提供API接口给我们。

- ##Demo链接: https://pan.baidu.com/s/1o8a1voI 密码: pbdd
***
>- ###有细心的小伙伴说:“UITableView滚动的时候,右边相应的索引没有跟着改变”?,于是加了下班,有了这个效果

- ##Demo链接: https://pan.baidu.com/s/1b2tZtW 密码: cv95
***
- #扩展
>- ###简单DES加密:


>- ###Demo链接: https://pan.baidu.com/s/1cEfBaQ 密码: 5r3d
***
***
***
>- ###应小伙伴需要:
- #OC版tableView索引仿写链接: https://pan.baidu.com/s/1kVBgAxD 密码: 1hmk
网友评论
的open func reloadSectionIndexTitles() // reloads the index bar.不知道怎么做的,做了个类似的但是会爆数组越界