I am using dropbox api in my app. I am displaying meta data at root in tableview controller using this code
[self.restClient loadMetadata:@"/" ];
- (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata {
[self.metaArray release];
self.metaArray = [[NSMutableArray alloc]init ];
for (DBMetadata *child in metadata.contents) {
NSString *folderName = [[child.path pathComponents] lastObject];
[self.metaArray addObject:folderName];
}
[self.tableView reloadData];
[self.activityIndicator stopAnimating];
}
It will returns:-
Photos
User
Public
This folder may contains other folders ,I am maintaining 2 level hierarchy like
Photo-> xyz.png
User -> Newfolder
I want to ask there may be folders in folders ..How can I manage levels of hierarchy…and how can I recognize by code that its folder or file??
In iOS you don’t usually display multiple levels of a hierarchy in an App. From the UINavigatorController Class Reference:
If you want to do it anyway you’ll need to take your directories and look at their data too. BTW, DropBox doesn’t really like this either so you will probably want to cache that level (though they aren’t too keen on you doing your own cacheing). To figure out if something is a directory or not look at the meta data: