IKImageBrowser loads files in reverse order?
I h开发者_C百科ave an IKImageBrowser
that loads images from the resources directory located inside the app. For some reason, the order it loads the file is in reverse, for example I have images 1-74, but they get loaded 74-1, any ideas?
Project is based off of the IKImageKit Demo.
Simple and 'ugly' solution:
// File: ControllerBrowsing.m:
// Function: - (void) addImagesFromDirectory:(NSString *) path
// Find:
for(i=0; i<n; i++)
// Replace with:
for(i=n-1; i>=0; i--)
Good solution (one of the many possibilities):
- Create a new NSMutableArray.
- Loop through the NSArray that contains the files.
- Add the paths to the NSMutableArray.
- Sort the NSMutableArray the way you like.
- Loop trough the NSMutableArray and add the items.
精彩评论