开发者

FIFO for images in Iphone

开发者 https://www.devze.com 2023-02-04 09:08 出处:网络
how to use the NSArray or 开发者_如何转开发NSMutableArray for the FIFO structure. I want to store the images in that structure.

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

精彩评论

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