user2813740
user2813740

Reputation: 337

achieve tree view like structure in iPhone App

I am trying to achieve tree like structure as shown in below image on my iPhone App

Package 1 => Packg 1.1 Package 1.1.1 Package 1.1.2 Packg 1.2

Its like user received Package having 3 bottles send by vendors. Either vendor has package each bottle as sub package or directly all three bottles within single package. Individual bottle is termed as Item and Package as Packages.

There is Package0010 as main package and depending on bottle packaging we either subdivide as three sub package having 1 item each. or two sub package(two item) and one separate item so total 3 Item or bottles.

How I can achieve above structure. Note I am using UILable, UITexfield, UITexfield with tags. I can not use UITableview ...

just idea if anyone came across such problem...

Upvotes: 0

Views: 3645

Answers (4)

Dzmitry Antonenka
Dzmitry Antonenka

Reputation: 15

I use SwiftListTreeDataSource to visualise hierarchical data structures (trees) in lists-like way. It's UI agnostic, just like view-model, so you can use it with UITableView/UICollectionView/NSTableView or even SwiftUI with search feature. enter image description here

Upvotes: 0

Samiul Islam Sami
Samiul Islam Sami

Reputation: 850

I designed a simple treeView in swift.

You can see the code in my GitHub

Upvotes: 0

Rohan
Rohan

Reputation: 2935

There are many samples available on cocoa controls. You can refer following link ;

Cocoa Controls

You can use any of following example;

1) Example 1

2) Example 2

3) Example 3

All these use UITableView's delegate and datasource methods, so you can easily integrate and modify it accordingly your requirements.

Hope this will help you.

Upvotes: 1

Vladimir Vodolazkiy
Vladimir Vodolazkiy

Reputation: 564

I use RATreeView component for similar tasks. It is used like UITableView with datasource and delegate protocols, and it is highly customisable.

https://github.com/Augustyniak/RATreeView

Upvotes: 2

Related Questions