开发者

FIFO for images in Iphone

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜