Latest0.0.2
Homepagehttps://github.com/CJYS/SectionIndexView
LicenseMIT
Platformsios 8.0, requires ARC
FrameworksUIKit
Authors

中文介绍

SectionIndexView which could be highly customized, can easily be used to customize the UITableView’s section index .

Overview

Demo Overview
Demo Overview
Demo Overview
Demo Overview
Demo Overview

Installation

pod 'SectionIndexView'

Usage

SectionIndexView is easy to use, API are like UITableView.

Init SectionIndexView.

override func viewDidLoad() {
    ......
    indexView = SectionIndexView.init(frame:frame)
    indexView.dataSource = self
    indexView.delegate = self
    view.addSubview(indexView)
    indexView.loadData()     // important
}

Conforming to protocol SectionIndexViewDataSource.

func numberOfItemViews(in sectionIndexView: SectionIndexView) -> Int {
    return indexData.count
}

func sectionIndexView(_ sectionIndexView: SectionIndexView, itemViewAt section: Int) -> SectionIndexViewItem {
    let itemView = SectionIndexViewItem.init()
    itemView.title = indexData[section]
    return itemView
}
// when you need SectionIndexViewItemPreview
func sectionIndexView(_ sectionIndexView: SectionIndexView, itemPreviewFor section: Int) -> SectionIndexViewItemPreview {
    let preview = SectionIndexViewItemPreview.init(title: indexData[section], type: .default)
    return preview
}

Conforming to protocol SectionIndexViewDelegate.
All of them are optional.

//didSelect
func sectionIndexView(_ sectionIndexView: SectionIndexView, didSelect section: Int)

//toucheMoved
func sectionIndexView(_ sectionIndexView: SectionIndexView, toucheMoved section: Int)

//toucheCancelled
func sectionIndexView(_ sectionIndexView: SectionIndexView, toucheCancelled section: Int)

Please see the demo for more details.

License

SectionIndexView is released under an MIT license.

Latest podspec

{
    "name": "SectionIndexView",
    "version": "0.0.2",
    "summary": "Customizing the UITableView's section index written in Swift",
    "authors": {
        "ChenJian": "[email protected]"
    },
    "homepage": "https://github.com/CJYS/SectionIndexView",
    "frameworks": "UIKit",
    "source": {
        "git": "https://github.com/CJYS/SectionIndexView.git",
        "tag": "0.0.2"
    },
    "source_files": "SectionIndexViewDemo/SectionIndexView/**/*.{h,m,swift}",
    "license": "MIT",
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "4.0",
    "requires_arc": true
}

Pin It on Pinterest

Share This