How to load multiple images in one XML call?

I am working on an iPhone application in which I need to download 100-200 images from a server using the image URL in a for loop. Example:

NSOperationQueue *queue = [NSOperationQueue new]; NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(downloadImages:) object:arrayTemp]; [queue addOperation:operation]; [operation release]; [queue release]; -(void)downloadImages{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; UIImage *image; for (int i=0; i < [self.ImagesRecords count]; i++) { ImageData *data =(ImageData*) [self.ImagesRecords objectAtIndex:i]; NSString *strName = [NSString stringWithFormat:@"image_%@",data.ID]; image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[@"http://abc.com" stringByAppendingString:data.PhotoPath]]]]; if (image!=nil) { [self saveImage:image withName:strName]; } } image = nil; [pool release]; } 

His work is beautiful and gives me an image.

My questions:

  • How can I get multiple images in one XML call? Is it possible?
  • What is the way to upload files? Provide a snippet of code.
  • Several times I found that my application got stuck for a while when this image is loading. What is the reason for this?
+4
source share
1 answer
  • example of several images in 1 xml:
 <xml> <info> <width>55</width> <height>41</height> </info> <image_data> <data> <name>Background</name> <data>data:image/png;base64,iVBORw0KGgoAAA...</data> </data> <data> <name>Layer #2</name> <data>data:image/png;base64,iVBORw0KGgoAAAANS...</data> </data> <data> <name>Layer #3</name> <data>data:image/png;base64,iVBORw0KGgoAAAANSUh...</data> </data> </image_data> </xml> 
0
source

All Articles