Code Monkey home page Code Monkey logo

sectionindexview's Introduction

中文介绍

SectionIndexView

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.

sectionindexview's People

Contributors

0xcj avatar

Watchers

James Cloos avatar xiaofei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.