GitXplorerGitXplorer
n

STBTableViewIndex

public
23 stars
1 forks
2 issues

Commits

List of commits on branch master.
Verified
8d04ab8cb97ce7d822275403e8cce64ce21fa7c0

Implemented basic pointer support.

nnicolasgomollon committed 5 years ago
Verified
4db9ad3385e34f4bf668f83ff849667d01d0a503

Fixed compiler warning.

nnicolasgomollon committed 5 years ago
Verified
bbc5000e4bbc1527e7943554b8ad0baa241b0c02

Fixed code styling.

nnicolasgomollon committed 5 years ago
Verified
d62fbcc5519c0ab2b444687d17b56298dbb9c0f5

Fixed code styling.

nnicolasgomollon committed 6 years ago
Verified
3ab5b34e660ea472441976ae1d063582c5f037ab

Updated for Swift 5 syntax & Xcode 10.2.

nnicolasgomollon committed 6 years ago
Unverified
224aa5e03d4c247e0b368ee0dd6b5dcb8c03c481

Updated sample project.

nnicolasgomollon committed 7 years ago

README

The README file for this repository.

STBTableViewIndex

STBTableViewIndex (STB is short for “Section Title Bar”) is a section index bar that only becomes visible when used (as seen in Ecoute), and works with UITableView and UICollectionView. STBTableViewIndex is written completely in Swift (adapted from Objective-C, original code by: kreeger/BDKCollectionIndexView).

Sample Screenshot

Usage

Here’s an example usage:

// Instantiate.
var indexView = STBTableViewIndex()

// Set titles.
indexView.titles = ["A", "B", "C", "D", "E"]

// Set delegate.
indexView.delegate = self

// Add subview.
navigationController?.view.addSubview(indexView)

// Enable automatic index bar hiding (hides when not in use).
indexView.autoHides = true

// Flash index bar (useful in methods such as viewWillAppear, to give the user a hint).
indexView.flashIndex()

Implement the delegate methods:

func tableViewIndexChanged(index: Int, title: String) {
	let indexPath = IndexPath(row: 0, section: index)
	tableView.scrollToRow(at: indexPath, at: .top, animated: false)
}

func tableViewIndexTopLayoutGuideLength() -> CGFloat {
	return topLayoutGuide.length
}

func tableViewIndexBottomLayoutGuideLength() -> CGFloat {
	return bottomLayoutGuide.length
}

See the IndexTest demo project included in this repository for a working example of the project, including the code above.

Requirements

Since STBTableViewIndex is written in Swift, it requires Xcode 6 or above and works on iOS 7 and above.

License

STBTableViewIndex is released under the MIT License.