简体   繁体   English

IKImageBrowser以相反的顺序加载文件?

[英]IKImageBrowser loads files in reverse order?

I have an IKImageBrowser that loads images from the resources directory located inside the app. 我有一个IKImageBrowser ,它从应用程序内部的资源目录加载图像。 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? 由于某种原因,它加载文件的顺序是相反的,例如我有图像1-74,但它们加载74-1,任何想法?

Project is based off of the IKImageKit Demo . 项目基于IKImageKit演示

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. 创建一个新的NSMutableArray。
  2. Loop through the NSArray that contains the files. 循环遍历包含文件的NSArray。
  3. Add the paths to the NSMutableArray. 将路径添加到NSMutableArray。
  4. Sort the NSMutableArray the way you like. 按照您喜欢的方式对NSMutableArray进行排序。
  5. Loop trough the NSMutableArray and add the items. 循环通过NSMutableArray并添加项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM