Popularity
3.2
Stable
Activity
0.0
Stable
128
7
31

Description

CITreeView created to implement and maintain that wanted TreeView structures for IOS platforms easy way. CITreeView provides endless treeview structure. You just add your data to CITreeview datasource.

Programming language: Swift
License: MIT License
Latest version: v1.6.1

CITreeView alternatives and similar libraries

Based on the "App Store" category.
Alternatively, view CITreeView alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of CITreeView or a related project?

Add another 'App Store' Library

README

CITreeView

CITreeView created to implement and maintain that wanted TreeView structures for IOS platforms easy way. CITreeView provides endless treeview structure. You just add your data to CITreeview datasource.

Twitter: @cekjacks CocoaPods Platform

|

Installation

CocoaPods (Recommended)

  1. Add additional entry to your Podfile.
pod 'CITreeView', '~> 1.6.1'
  1. Pod Install
pod install

Manual

  1. Download .zip file
  2. Just drag and drop CITreeViewClasses folder to your project

Usage

Initialization

  1. Firstly, import CITreeView
import CITreeView
  1. Add CITreeViewDelegate and CITreeViewDataSource to your view controller
class ViewController:UIViewController,CITreeViewDelegate,CITreeViewDataSource
  1. Initialize and configure CITreeView
let ciTreeView = CITreeView.init(frame: self.view.bounds, style: UITableViewStyle.plain)
ciTreeView.treeViewDelegate = self
ciTreeView.treeViewDataSource = self
self.view.addSubview(ciTreeView)
  1. Implement required methods of the CITreeView's delegates
func treeView(_ treeView: CITreeView, atIndexPath indexPath: IndexPath, withTreeViewNode treeViewNode: CITreeViewNode) -> UITableViewCell {

return cell;
}
func treeViewSelectedNodeChildren(for treeViewNodeItem: AnyObject) -> [AnyObject] {
        if let dataObj = treeViewNodeItem as? CITreeViewData {
            return dataObj.children
        }
        return []
    }
func treeViewDataArray() -> [AnyObject] {
return yourDataArray
}
func treeView(_ tableView: CITreeView, heightForRowAt indexPath: IndexPath, withTreeViewNode treeViewNode:CITreeViewNode) -> CGFloat {
return UITableViewAutomaticDimension
}
func treeView(_ treeView: CITreeView, didSelectRowAt treeViewNode:CITreeViewNode) {}

func willExpandTreeViewNode(treeViewNode: CITreeViewNode, atIndexPath: IndexPath) {}

func didExpandTreeViewNode(treeViewNode: CITreeViewNode, atIndexPath: IndexPath) {}

func willCollapseTreeViewNode(treeViewNode: CITreeViewNode, atIndexPath: IndexPath) {}

func didCollapseTreeViewNode(treeViewNode: CITreeViewNode, atIndexPath: IndexPath) {}

Features

  1. You can only open one node at a time if you wish. If another parent node is selected while a node is opened, the open nodes will closed automatically.
ciTreeView.collapseNoneSelectedRows = true

Recently Added Features

1. connect CITreeView delegate and datasource with interface builder
2. expand all rows with expandAllRows()
3. collapse all rows with collapseAllRows()
4. get parent node of selected node as CITreeViewNode.parentNode
5. reload data without lose rows states that expanded or collapses with reloadDataWithoutChangingRowStates()

License

MIT licensed, Copyright (c) 2018 Cenk Işık, @cekjacks


*Note that all licence references and agreements mentioned in the CITreeView README section above are relevant to that project's source code only.