Latest 0.1.4
Homepage https://github.com/chaddgrimm/melodeon
License MIT
Platforms ios 9.0
Authors

Apps Using
Downloads
Language

CI Status
codecov.io
Version
License
Platform

Twitter: @chaddgrimm

A simple subclass of UITableViewController which behaves like a melodeon.

Screen capture

Usage

Inherit MelodeonController and implement it just like you would on a normal UITableViewController.

  class TableViewController: MelodeonController {
    var firstList = ["Option One", "Option Two", "Option Three"]
    var secondList = ["Choice One", "Choice Two", "Choice Three", "Choice Four" ]
    var thirdList = ["Element One", "Element Two"]

    ...
    .....

  }

Provide your sections as array and override the sections property.

  override var sections:[Any] {
    return ["List A", "List B", "List C"]
  }

And provide the number of rows per section (this is required).

  override func numberOfRows(inSection section:Int) -> Int {
    switch section {
    case 0:
      return firstList.count
    case 1:
      return secondList.count
    case 2:
      return thirdList.count
    default:
      return 0
    }
  }

Optional:

You may implement your own header cell as long as it is of type MelodeonHeaderCell.

  override var headerClasses:[MelodeonHeaderCell.Type]? {
    return [TableHeaderCell.self, AnotherHeaderCell.self]
  }

You may also provide the section which will be expanded when the view is loaded.

  override var initialExpandedSection: Int {
    return 0
  }

You can control which header is interactive.

  override func header(_ header: MelodeonHeaderCell, shouldTapAtSection section: Int) -> Bool {
    if section == 1 {
      return false
    }
    return true
  }

Or handle the tap events.

  override func header(_ header: MelodeonHeaderCell, didTapAtSection section: Int) {
    // TODO: Implement header tap event here
  }

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

Melodeon is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "Melodeon"

Author

Chad Lee, [email protected]

License

Melodeon is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Melodeon",
    "version": "0.1.4",
    "summary": "A table view which behaves like a melodeon.",
    "description": "A subclassable of table view controller which behaves like a melodeon, subclassed from UITableViewController.",
    "homepage": "https://github.com/chaddgrimm/melodeon",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "chaddgrimm": "[email protected]"
    },
    "source": {
        "git": "https://github.com/chaddgrimm/melodeon.git",
        "tag": "0.1.4"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "Melodeon/Classes/**/*",
    "pushed_with_swift_version": "3.0.2"
}

Pin It on Pinterest

Share This