SCTableIndex
Description
SCTableIndex is tableview item index list not use section Header. If you set the sorted item as a string array, it makes a table of contents with the first letter. Then click on the letter to move the table view to the first item.
ScreenShot
Requirements
* Swift 4.2
* XCode 10.0
* iOS 9.0 (Min SDK)
Installation
SCTableIndex is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SCTableIndex"
pod "SCTableIndex", -> '0.2.0' //Swift 4.2
pod "SCTableIndex", -> '0.1.2' //Swift 4.0
//After
pod install
How To Use
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)
}
}
Author
myoung
License
SCTableIndex is available under the MIT license. See the LICENSE file for more info.