SCTableIndex
描述
SCTableIndex 是不使用分区标题的 tableView 项目索引列表。如果您将排序项设置为字符串数组,它将根据首字母创建一个目录表。然后点击字母来移动 TableView 到第一个项目。
屏幕截图
需求
* Swift 4.2
* XCode 10.0
* iOS 9.0 (Min SDK)
安装
SCTableIndex 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "SCTableIndex"
pod "SCTableIndex", -> '0.2.0' //Swift 4.2
pod "SCTableIndex", -> '0.1.2' //Swift 4.0
//After
pod install
如何使用
import SCTableIndex
arrItem.sort()
sctbindex.delegate = self
//Use Selector Font, HelveticaNeue-Medium is Normal Font
//sctbindex.initialFont = UIFont(name: "HelveticaNeue-Medium", size: 13)!
//Use Selector initial Text Color, black is Normal Color
//sctbindex.initialTextColor = UIColor(red: 50.0/255.0, green: 50.0/255.0, blue: 50.0/255.0, alpha: 1.0)
//String Array item
sctbindex.setView(arrItem)
//MARK: SCTableIndex Delegate
extension ViewController: SCTableIndexDelegate {
// Move starting point item that select initial text
func scTableIndexReturnInitialText(_ strInitial: String, index: Int) {
tbMain.scrollToRow(at: IndexPath(row: index, section: 0), at: .top, animated: true)
}
}
作者
myoung
许可证
SCTableIndex 是在 MIT 许可证下可用的。有关更多信息,请参阅 LICENSE 文件。