nmoutlineview

by gkopel

gkopel /nmoutlineview

Hierarchical Menu for iOS

130 Stars 8 Forks Last release: Not found MIT License 7 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

NMOutlineView: Hierarchical Menu for iOS

Preview

NMOutlineView preview

Description

NMOutlineView is a simple implementation of hierarchical menu for iOS. Menu items can be collapsed/expanded and are displayed on different indentation levels. NMOutlineView is internally implemented as UITableView object, it's items (cells) are subclasses of UITableViewCell class, so it's easy to customize their appearance with UITableViewCell API. NMOutlineView exposes a datasource protocol. The protocol methods are similar to NSOutlineViewDatasource protocol available on macOS. See example app for implementation details.

Installation and Setup

  • Add NMOutlineView.swift and NMoutlineViewCell.swift to your project
  • Set your view controller as a datasource object of NMOutlineView instance.
  • Implement datasource protocol methods described below.

Requirements

  • Swift 4.0 or later

Datasource Methods

/* 
Returns the number of child items encompassed by the given item.
*/
func outlineView(_ outlineView: NMOutlineView, numberOfChildrenOfCell parentCell: NMOutlineViewCell?) -> Int  
/*
Returns a Boolean value that indicates whether the given item is expandable.  
*/
func outlineView(_ outlineView: NMOutlineView, isCellExpandable cell: NMOutlineViewCell) -> Bool 
/*
Invoked by outlineView to return the child cell object of the given parent item. 
*/
func outlineView(_ outlineView: NMOutlineView, childCell index: Int, ofParentAtIndexPath parentIndexPath: IndexPath?) -> NMOutlineViewCell
/*
Tells the datasource object that the specified row is now selected.
*/
func outlineView(_ outlineView: NMOutlineView, didSelectCell cell: NMOutlineViewCell);

License

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.