0
我試圖從一個plist文件中製作一個包含要從我的資源文件夾中拉出的圖像名稱的對象數組(animalImages)。我嘗試使用for循環來單獨添加每個圖像,但以某種方式迷失在邏輯中。這是我有:從plist文件中填充圖像
NSString *images = [[NSBundle mainBundle] pathForResource:@"images" ofType:@"plist"]; //string with resource path
animalImageNames = [[NSMutableArray alloc] initWithContentsOfFile:images]; //array with file names
int i;
int j = 10;
for (i=0; i <=j; i++) {
animalImages = [[NSArray alloc] initWithObjects:
[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"%@.png",[animalImageNames objectAtIndex:i]]]];
}
我想我可能會被拍打我的頭,一旦我得到一個答案,但我只是困惑業務的這段代碼的initWithImage部分的順序。
謝謝!是的,這就像一個魅力 – user550323 2011-01-06 22:16:32