Latest 1.6.1
Homepage https://github.com/cenksk/CITreeView
License MIT
Platforms ios 10.0
Authors

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
Build Status

CITreeView | CITreeView

Installation

CocoaPods (Recommended)

  1. Add additional entry to your Podfile.
pod 'CITreeView', '~> 1.6'
  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

Latest podspec

{
    "name": "CITreeView",
    "version": "1.6.1",
    "summary": "CITreeView created to implement and maintain that wanted TreeView structures for IOS platforms easy way.",
    "description": "CITreeView created to implement and maintain that wanted TreeView structures for IOS platforms easy way. CITreeView offers an infinite treeview structure and is constantly being developed",
    "homepage": "https://github.com/cenksk/CITreeView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Cenk Iu015fu0131k": "[email protected]"
    },
    "source": {
        "git": "https://github.com/cenksk/CITreeView.git",
        "tag": "1.6.1"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "CITreeViewClasses/*.swift",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This