How to implement a file development project for iphone

I am trying to implement a File Explore project for iPhone where a user can view files inside my application , so are there any examples of links for him.

+3
source share
1 answer

It seems to me that you only need to take a look at NSFileManager -Class, which can display files in folders, get file attributes, create / delete files ... Inside the class reference you can also find code examples.

some additional snippets:

How to get the application folder:

NSString *appFolder = NSHomeDirectory();

list of files in the specified folder:

NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; //App-Documents-Folder
NSError *error = nil;
NSArray *contentList = [manager contentsOfDirectoryAtPath:path error:&error];
if(error)
{
    NSLog(@"ERROR LISTING FILES: %@",[error description]);
    return;
}
for (NSString *s in contentList)
{
    NSLog(@"%@",s);
} 

The only thing you need to do is associate this information with a table view or another.

0

All Articles