¡@

Home 

2014/10/15 ¤U¤È 10:06:46

iphone Programming Glossary: dircontents

Getting a list of files in a directory with a glob

http://stackoverflow.com/questions/499673/getting-a-list-of-files-in-a-directory-with-a-glob

stuck with something along the lines of NSString bundleRoot NSBundle mainBundle bundlePath NSArray dirContents NSFileManager defaultManager directoryContentsAtPath bundleRoot ..and then stripping out the stuff.. bundleRoot NSBundle mainBundle bundlePath NSFileManager fm NSFileManager defaultManager NSArray dirContents fm contentsOfDirectoryAtPath bundleRoot error nil NSPredicate fltr NSPredicate predicateWithFormat @.. error nil NSPredicate fltr NSPredicate predicateWithFormat @ self ENDSWITH '.jpg' NSArray onlyJPGs dirContents filteredArrayUsingPredicate fltr If you need to do it with NSURL instead it looks like this NSURL bundleRoot..

Make movie file with picture Array and song file, using AVAsset

http://stackoverflow.com/questions/6061092/make-movie-file-with-picture-array-and-song-file-using-avasset

NSDocumentDirectory NSUserDomainMask YES objectAtIndex 0 NSArray dirContents NSFileManager defaultManager directoryContentsAtPath documentsDirectoryPath for NSString tString in.. defaultManager directoryContentsAtPath documentsDirectoryPath for NSString tString in dirContents if tString isEqualToString @ essai.mp4 NSFileManager defaultManager removeItemAtPath NSString stringWithFormat.. NSDocumentDirectory NSUserDomainMask YES objectAtIndex 0 NSArray dirContents NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectoryPath error nil for NSString..

Getting a list of files in a directory with a glob

http://stackoverflow.com/questions/499673/getting-a-list-of-files-in-a-directory-with-a-glob

of files with a glob for a given directory. I'm currently stuck with something along the lines of NSString bundleRoot NSBundle mainBundle bundlePath NSArray dirContents NSFileManager defaultManager directoryContentsAtPath bundleRoot ..and then stripping out the stuff I don't want which sucks. But what I'd really like is to be.. pretty easily with the help of NSPredicate like so NSString bundleRoot NSBundle mainBundle bundlePath NSFileManager fm NSFileManager defaultManager NSArray dirContents fm contentsOfDirectoryAtPath bundleRoot error nil NSPredicate fltr NSPredicate predicateWithFormat @ self ENDSWITH '.jpg' NSArray onlyJPGs dirContents filteredArrayUsingPredicate.. NSArray dirContents fm contentsOfDirectoryAtPath bundleRoot error nil NSPredicate fltr NSPredicate predicateWithFormat @ self ENDSWITH '.jpg' NSArray onlyJPGs dirContents filteredArrayUsingPredicate fltr If you need to do it with NSURL instead it looks like this NSURL bundleRoot NSBundle mainBundle bundleURL NSArray dirContents fm..

Make movie file with picture Array and song file, using AVAsset

http://stackoverflow.com/questions/6061092/make-movie-file-with-picture-array-and-song-file-using-avasset

path withSize CGSize size NSString documentsDirectoryPath NSSearchPathForDirectoriesInDomains NSDocumentDirectory NSUserDomainMask YES objectAtIndex 0 NSArray dirContents NSFileManager defaultManager directoryContentsAtPath documentsDirectoryPath for NSString tString in dirContents if tString isEqualToString @ essai.mp4 NSFileManager.. NSUserDomainMask YES objectAtIndex 0 NSArray dirContents NSFileManager defaultManager directoryContentsAtPath documentsDirectoryPath for NSString tString in dirContents if tString isEqualToString @ essai.mp4 NSFileManager defaultManager removeItemAtPath NSString stringWithFormat @ @ @ documentsDirectoryPath tString error nil .. path withSize CGSize size NSString documentsDirectoryPath NSSearchPathForDirectoriesInDomains NSDocumentDirectory NSUserDomainMask YES objectAtIndex 0 NSArray dirContents NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectoryPath error nil for NSString tString in dirContents if tString isEqualToString @ essai.mp4..

Getting a list of files in a directory with a glob

http://stackoverflow.com/questions/499673/getting-a-list-of-files-in-a-directory-with-a-glob

I'm currently stuck with something along the lines of NSString bundleRoot NSBundle mainBundle bundlePath NSArray dirContents NSFileManager defaultManager directoryContentsAtPath bundleRoot ..and then stripping out the stuff I don't want which sucks... like so NSString bundleRoot NSBundle mainBundle bundlePath NSFileManager fm NSFileManager defaultManager NSArray dirContents fm contentsOfDirectoryAtPath bundleRoot error nil NSPredicate fltr NSPredicate predicateWithFormat @ self ENDSWITH '.jpg'.. bundleRoot error nil NSPredicate fltr NSPredicate predicateWithFormat @ self ENDSWITH '.jpg' NSArray onlyJPGs dirContents filteredArrayUsingPredicate fltr If you need to do it with NSURL instead it looks like this NSURL bundleRoot NSBundle mainBundle..

NSPredicate endswith multiple files

http://stackoverflow.com/questions/5032541/nspredicate-endswith-multiple-files

ending in a set of extensions. How could I do it Would something close to 'self endswith in @' work Thanks NSArray dirContents NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectoryPath error nil NSArray files dirContents filteredArrayUsingPredicate.. dirContents NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectoryPath error nil NSArray files dirContents filteredArrayUsingPredicate NSPredicate predicateWithFormat @ self CONTAINS @ NSArray arrayWithObjects @ .mp4 @ .mov @ .m4v.. by the path extension. So NSArray extensions NSArray arrayWithObjects @ mp4 @ mov @ m4v @ pdf @ doc @ xls nil NSArray dirContents NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectoryPath error nil NSArray files dirContents filteredArrayUsingPredicate..

Make movie file with picture Array and song file, using AVAsset

http://stackoverflow.com/questions/6061092/make-movie-file-with-picture-array-and-song-file-using-avasset

NSSearchPathForDirectoriesInDomains NSDocumentDirectory NSUserDomainMask YES objectAtIndex 0 NSArray dirContents NSFileManager defaultManager directoryContentsAtPath documentsDirectoryPath for NSString tString in dirContents if tString.. dirContents NSFileManager defaultManager directoryContentsAtPath documentsDirectoryPath for NSString tString in dirContents if tString isEqualToString @ essai.mp4 NSFileManager defaultManager removeItemAtPath NSString stringWithFormat @ @ @ documentsDirectoryPath.. NSSearchPathForDirectoriesInDomains NSDocumentDirectory NSUserDomainMask YES objectAtIndex 0 NSArray dirContents NSFileManager defaultManager contentsOfDirectoryAtPath documentsDirectoryPath error nil for NSString tString in dirContents..