hai,我在UIImage中加载一个图像。但它的分辨率非常低。我可以提高图像的分辨率..(不使用“预览”并从服务器获取图像)。提前谢谢。这是我的代码。
- (void) loadCatalogImage
{
@try{
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
//NSArray *array = [global_ContentString componentsSeparatedByString:@"@@#"];
NSArray *array1 = [catalogURL componentsSeparatedByString:@"&"];
//**NSLog(@"array1****** = %@",array1);
NSLog(@"loading catalog image(method: loadCatalogImage).......%@%@",baseURL, [[[array1 objectAtIndex:0] componentsSeparatedByString:@"##"] objectAtIndex:0]);
//NSLog(@"baseURL = %@",baseURL);
NSLog(@"loading catalog image.......%@%@",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(@"aaaaaaaaaaaaaa = %@",zoomedImageURL);
//UIImage *img = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",baseURL, [[[array1 objectAtIndex:0] componentsSeparatedByString:@"##"] objectAtIndex:0]]]]];
UIImage *img1;
img1 = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",zoomedImageURL]]]];
/*UIGraphicsBeginImageContext(img1.size);
[img1 drawInRect:CGRectMake(0,0, 768,1024)];
UIImage* img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();*/
imgView.contentMode = UIViewContentModeScaleAspectFit;
//imgView.image = img;//[GPSTripTracking generatePhotoThumbnail:img:109];
//NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:gameObj.gameThumbnails]];
// UIImage *myImage=[UIImage imageWithData:data];
//imgView.image=UIImageJPEGRepresentation(img, 90);// I am missing something here
imgView.image=img1;
//imgView.image=[img blurredCopyUsingGuassFactor:0.0 andPixelRadius:0.0];
[pool release];
[global_imgProgress stopAnimating];
}
@catch (NSException *e) {
[global_imgProgress stopAnimating];
NSLog(@"Exception....");
}
@finally {
}
// NSLog(@"Voucher image created at VoucherView.m = %@", [NSString stringWithFormat:@"%@%@", baseURL, [array1 objectAtIndex:0]]);//[NSString stringWithFormat:@"%@%@", baseURL, [urlArray objectAtIndex:(2 + pageNo)]]);
}