使用SectionIndexView自定义UITableView索引,项目的demo里面提供了全面的演示。
预览:
默认效果 | 使用图片 | 自定义 |
---|---|---|
使用方法
override func viewDidLoad() {
......
let titles = ["A","B","C","D","E","F","G"]
let items = titles.compactMap { (title) -> SectionIndexViewItem? in
let item = SectionIndexViewItemView.init()
item.title = title
return item
}
self.tableView.sectionIndexView(items: items)
}