开发者

IKImageBrowser loads files in reverse order?

开发者 https://www.devze.com 2023-02-12 04:42 出处:网络
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,

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):

  1. Create a new NSMutableArray.
  2. Loop through the NSArray that contains the files.
  3. Add the paths to the NSMutableArray.
  4. Sort the NSMutableArray the way you like.
  5. Loop trough the NSMutableArray and add the items.
0

精彩评论

暂无评论...
验证码 换一张
取 消