How to get the count of array of images
i m parsing a json feed .using async image download I m downloading images (around 18 images) and storing it in UIImage.how to get the count of the images so that i can iterate in a loop.below is the 开发者_如何学JAVAcode
- (void)webImageManager:(SDWebImageManager *)imageManager didFinishWithImage:(UIImage *)image
{ UIImage *boom=image;
//download the image and storing it in UIImage
}
In your delegate callback you should be adding the processed element to an NSMutableArray
. Something like this:
// MainViewController.h
...
{
NSMutableArray *synced;
}
@property (nonatomic, retain) NSMutableArray *synced;
And:
// MainViewController.m
@synthesize synced;
...
- (void)viewDidLoad
{
[super viewDidLoad];
self.synced = [NSMutableArray array];
}
- (void)webImageManager:(SDWebImageManager *)imageManager didFinishWithImage:(UIImage *)image
{
[self.synced addObject:image];
self.syncedLabel.text = [NSString stringWithFormat:@"%i images", [self.synced count]];
}
精彩评论