All Projects → genkernel → TreeView

genkernel / TreeView

Licence: MIT license
"TreeView - sub-cells simplified" (c). Enable subcells in UITableView with a single drop-in extension. CocoaPod:

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to TreeView

Accordion-Collapse-react-native
React native Accordion/Collapse component, very good to use in toggles & show/hide content
Stars: ✭ 147 (+172.22%)
Mutual labels:  collapse, expandable, expand, collapsable
ExpandableRecyclerView
ExpandableRecyclerView with smoothly animation.
Stars: ✭ 412 (+662.96%)
Mutual labels:  expandable, expandablelistview, treeview
WBChainMenu
This will show horizontal menu to a UITableViewCell with chain animation
Stars: ✭ 28 (-48.15%)
Mutual labels:  uitableview, uitableviewcell
iOSEasyList
A data-driven UICollectionView and UITableView framework for building fast and flexible lists
Stars: ✭ 29 (-46.3%)
Mutual labels:  uitableview, expandable
Swipecellkit
A swipeable UITableViewCell or UICollectionViewCell with support for:
Stars: ✭ 5,745 (+10538.89%)
Mutual labels:  uitableview, uitableviewcell
Automatic Height Tagcells
This is a sample project to implement features with dynamic height of UITableViewCell based on autolayout, tags aligned automatically and clickable tags.
Stars: ✭ 229 (+324.07%)
Mutual labels:  uitableview, uitableviewcell
TableViewKit
Empowering UITableView with painless multi-type cell support and built-in automatic state transition animations
Stars: ✭ 105 (+94.44%)
Mutual labels:  uitableview, uitableviewcell
Tablekit
Type-safe declarative table views.
Stars: ✭ 567 (+950%)
Mutual labels:  uitableview, uitableviewcell
ZHTableViewGroup
Manger UITableView DataSource Cells
Stars: ✭ 19 (-64.81%)
Mutual labels:  uitableview, uitableviewdatasource
Datasource
Simplifies the setup of UITableView data sources using type-safe descriptors for cells and sections. Animated diffing built-in.
Stars: ✭ 72 (+33.33%)
Mutual labels:  uitableview, uitableviewcell
Mdl11 generics
Example project that was demonstrated on MDL #11 meetup - https://www.youtube.com/watch?v=A4FrEyFBjVA. Medium article - https://medium.com/chili-labs/configuring-multiple-cells-with-generics-in-swift-dcd5e209ba16
Stars: ✭ 50 (-7.41%)
Mutual labels:  uitableview, uitableviewcell
Tdbadgedcell
TDBadgedCell is a table view cell class that adds a badge, similar to the badges in Apple's own apps
Stars: ✭ 1,444 (+2574.07%)
Mutual labels:  uitableview, uitableviewcell
PluginTableViewController
Example project for article: Data-Driven Table Views. See blog post for more details: http://www.vadimbulavin.com/data-drive-table-views/
Stars: ✭ 18 (-66.67%)
Mutual labels:  uitableview, uitableviewdatasource
UITableViewCellAnimation
Basic tabeview cell animation for best way to display cell
Stars: ✭ 31 (-42.59%)
Mutual labels:  uitableview, uitableviewcell
Expandabletable
AZExpandable is a lightweight proxy for UITableView to expand cells.
Stars: ✭ 218 (+303.7%)
Mutual labels:  uitableview, uitableviewcell
Multiple-collectionView-in-Multiple-tableView-cells
UICollectionView is embed in UITableViewCell. The collection views are horizontal scrollable. The UITableView can have a section title for each UICollectionView and the number of UICollectionView is equal to the number of sections.
Stars: ✭ 23 (-57.41%)
Mutual labels:  uitableview, uitableviewcell
Uitableviewdynamiclayoutcacheheight
🖖高性能的自动计算采用 Autolayout 布局的 UITableViewCell 和 UITableViewHeaderFooterView 的高度,内部自动管理高度缓存。
Stars: ✭ 360 (+566.67%)
Mutual labels:  uitableview, uitableviewcell
Pbtreeview
An UITreeView implementation from UITableView that Apple missed in its UIKit framework. And it is in pure Swift.
Stars: ✭ 128 (+137.04%)
Mutual labels:  uitableview, treeview
Grouprecyclerviewadapter
可增删改查、可动画展开收起、可吸附悬浮动态可配置的分组列表
Stars: ✭ 41 (-24.07%)
Mutual labels:  collapse, expandable
Fole
Fole is a simple library to collapse and expand a TextView.
Stars: ✭ 67 (+24.07%)
Mutual labels:  collapse, expandable

TreeView is iOS single-class component written in ObjC that enables cell + subcells support for UITableView-s.

  • Project status
  • Examples
  • Documentation

Current status

TreeView was initially written in 2012 and has been used in multiple projects since then. Development is finalized, component and its public API is considered stable.

The most convenient way to use it is via CocoaPods:

pod 'TreeView'

Aletrnativelly you may simply drop TreeView/TreeTable.h,m into your project.

Examples

Preview on Youtube: http://youtu.be/zS3gQ4pnmBs

You may find demo iOS app with 3 working modules in 'Examples' directory:

  • inSwift-4.2
  • fileSystem-asTree
  • plist-allExpanded-byDefault

Documentation

In basic MVC scenario ViewController is set as DataSource of UITableView.

TreeView package introduces single new class: TreeTable. It is designed to sit in between ViewController and UITableView as a DataSource object that knows how to work with subcells via deeper "nested" indexPaths.

TreeTable implements UITableViewDataSource protocol and represents inner subcells with indexPaths of deeper levels. For instance cell at 0-0 indexPath may contain 3 subcells: 0-0-0, 0-0-1, 0-0-2.

In plan MVC example: TreeTable is a "proxy" object that sits between tableView and a viewController, proxies all calls to data source and converts 2d-like indexPaths (0-0, 0-1, ...) into N-depth indexPaths (0-0, 0-0-1, 0-0-2, 0-1-0-1, ...) to represent subcells.

You usually decide to use TreeTable component when your UITableViewCell wants to contain its own subcells that can be easily expanded or collapsed.

Implementation details

TreeTable adds 2 logical states to every cell: expanded and collapsed.

You should expand a cell to reveal its subcells.

Keeping this in mind helper methods(as UITableView category) were implemented:

func expand(treeIndexPath: IndexPath)
func isExpanded(treeIndexPath: IndexPath) -> Bool
func collapse(treeIndexPath: IndexPath)

Instead of implementing UITableViewDataSource in your controller - implement TreeTableDataSource. TreeTableDataSource protocol extends UITableViewDataSource by introducing 2 new required methods:

func tableView(_ tableView: UITableView, isCellExpandedAt treeIndexPath: IndexPath) -> Bool
func tableView(_ tableView: UITableView, numberOfSubCellsForCellAt treeIndexPath: IndexPath) -> Int

Notice all required dataSource methods are invoked with indexPath of N-depth that uniquely identify cell or subcell.
Hence you should change behaviour of the following methods:

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
func tableView(tableView: UITableView, cellForRowAt treeIndexPath: IndexPath) -> UITableViewCell

and use

func tableIndexPathFromTreePath(treeIndexPath: IndexPath) -> IndexPath

if you need to convert N-depth index path into 2d index path.

On the other hand all optional methods are transparently forwarded to your implementations (if you provide any) and indexPath parameter is not changed - it is 2d indexPath. You can convert it into N-depth treeIndexPath with:

func treeIndexPathFromTablePath(indexPath: NSIndexPath) -> NSIndexPath

method.

Concept image

Concept

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].