Bart Jacobs
Bart Jacobs

Reputation: 9082

Mimic NSOutlineView with UIKit

I'm currently looking for a solution to mimic NSOutlineView with UIKit. The idea is to create a UITableView that displays a hierarchy similar to the list view in a typical Finder window. In other words, items can be expanded or not, and each item can contain children or not.

Since the hierarchy can be several levels deep, using only sections is not an option. The tricky part is to have a controller that efficiently manages the data source of the table view and knows what items are expanded and how many rows to collapse or expand when the user interacts with the table view.

I'm not asking for a ready-made solution, but I would appreciate pointers or advice to get this working in an efficient way.

Upvotes: 3

Views: 352

Answers (1)

Christian Beer
Christian Beer

Reputation: 2025

I can't give no hints regarding efficiency. But UITableViewCells have some built in support for levels. You can set an amount for indentation and a level for each cell. So the indentation part is easy. But expansion is quite difficult.

I did a somewhat inneficient implementation for one of my apps, but I can be quite sure that there are no more than some hundret items. So the efficiency was efficient enough.

Upvotes: 1

Related Questions