简体   繁体   中英

How to present hierarchical data using tableviewcontroller in ios

Am a newbie to ios development.

Building a simple app that lets users navigate hierarchical data. For eg, navigating directory structures.

We built a TreeViewController and set the data source to the first level. What's not clear is to how to initialize the same controller and push it so that the next level can be represented.

I tried the following:

UIStoryboard *storyboard = [self storyboard];
CVBrowseViewController *selfController = [storyboard instantiateViewControllerWithIdentifier:@"browseTable"];


//Push the new table view on the stack
[self.navigationController pushViewController:self animated:YES];

[selfController setFolderList:children];

However, this throws an error: Pushing the same view controller instance more than once is not supported

This line:

[self.navigationController pushViewController:self animated:YES];

should be:

[self.navigationController pushViewController:selfController animated:YES];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM