I am loading images in UIWebview using the following code. For each image (while scrolling my scrollview) a function is called to load the image. The problem is that when I am continuously scrolling up to 30 images the application crashes. What may be the reason? My images are 1300 by 1200 pixels. Please help me find a solution.
- (void) loadCatalogImage
{
@try{
// if(imgView.image != nil)
// return;
// [global_imgProgress startAnimating];
//NSLog(@"image loading at = %@, %d", baseURL, 2 + pageNo);
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
//NSArray *array = [global_ContentString componentsSeparatedByString:@"@@#"];
NSArray *array1 = [catalogURL componentsSeparatedByString:@"&"];
//NSLog(@"baseURL = %@",baseURL);
NSLog(@"loading catalog image(method: loadCatalogImage).......%@%@",baseURL, [[[array1 objectAtIndex:0] componentsSeparatedByString:@"##"] objectAtIndex:0]);
zoomedImageURL = [NSString stringWithFormat:@"%@%@", baseURL, [[[array1 objectAtIndex:0] componentsSeparatedByString:@"##"] objectAtIndex:1]];
// NSLog(@"Catalog ZOOM URL = %@", zoomedImageURL);//[[array1 objectAtIndex:0] componentsSeparatedByString:@"##"]);//[[[array objectAtIndex:[[global_CatalogRef objectAtIndex:pageNo] intValue]] componentsSeparatedByString:@"##"] objectAtIndex:3]);
[zoomedImageURL retain];
NSLog(@"aaaaaaa = %@",zoomedImageURL);
[webView loadRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:
[NSString stringWithFormat:@"%@%@",baseURL, [[[array1 objectAtIndex:0] componentsSeparatedByString:@"##"] objectAtIndex:1]
]
]]
];
}
}