how to use the NSArray
or 开发者_如何转开发NSMutableArray
for the FIFO structure. I want to store the images in that structure.
Is it possible??
Sure it is possible:
-(void) queueImage:(UIImage*)image {
[_array addObject:image];
}
-(UIImage*) dequeueImage {
if (![_array count]) return nil;
UIImage *image = [[[_array objectAtIndex:0] retain] autorelease];
[_array removeObjectAtIndex:0];
return image;
}
_array must be a NSMutableArray.
精彩评论