我正在尝试将一些 UIImage 对象添加到数组中,但它不起作用。我尝试将图像添加到 NSArray 并且由于某种原因,该数组没有保存任何东西?
这是我的代码:
UIImage *a = [UIImage imageWithContentsOfFile:@"A.jpg"];
UIImage *b = [UIImage imageWithContentsOfFile:@"B.jpg"];
UIImage *c = [UIImage imageWithContentsOfFile:@"C.jpg"];
UIImage *d = [UIImage imageWithContentsOfFile:@"D.jpg"];
UIImage *e = [UIImage imageWithContentsOfFile:@"E.jpg"];
UIImage *f = [UIImage imageWithContentsOfFile:@"F.jpg"];
self.imageArray = [NSArray arrayWithObjects:a, b, c, d, e, f, nil];
int firstArrayCount = [self.array count];
NSLog(@"%d objects in array 1", firstArrayCount);
int secondArrayCount = [self.imageArray count];
NSLog(@"%d objects in array 2", secondArrayCount);