Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.37 KB

README.md

File metadata and controls

43 lines (31 loc) · 1.37 KB

M4KTableIndexView

Customize the index view of a UITableView. This allows users to scroll with more precision than the standard controls Apple offers.

Using Apple's standard control Using M4KTableIndexView

Demo

Open and run the included SampleContactList.xcodeproj

Installation

  1. Copy the files from M4KTableIndexView/ into Xcode.
  2. In your View Controller, add an IBOutlet for the View:
@IBOutlet weak var indexView: M4KTableIndexView!
  1. Setup the indexView:
indexView.tableView = self.tableView
indexView.indexes = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
indexView.setup()
  1. Add a UIView element to your Storyboard positioned next to your UITableView. Connect this to the IBOutlet created in #2.
  2. (Optional) Make your View Controller be the indexView's delegate and implement the delegate method:
class ViewController: UIViewController, M4KTableIndexDelegate {

	...
	indexView.delegate = self
	...

	func indexDisplayText(for indexPath: IndexPath) -> String {
		// Return a short string to display on screen
		return ""
	}