我正在创建一个应用程序,用户可以在其中将他们的日程表加载到应用程序中,然后显示它。
当允许在加载前编辑图像时,它会完美显示:
一旦用户“选择”了图像,它就会以UIImageView
模糊的形式出现:
这里稍微放大:
我知道图像分辨率还可以,因为图像可以预先完美显示。 我怎样才能阻止它变得模糊?
我正在使用放大UIImageView
.UIScrollView
这是我用来分配图像的代码。zoomscroll 是,UIScrollView
而 myschedule 是UIImageView
:
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissModalViewControllerAnimated:YES];
//Obtaining saving path
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *imagePath = [documentsDirectory stringByAppendingPathComponent:@"myschedule.png"];
//Extracting image from the picker and saving it
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:@"public.image"]){
UIImage *editedImage = [info objectForKey:UIImagePickerControllerEditedImage];
NSData *webData = UIImagePNGRepresentation(editedImage);
[webData writeToFile:imagePath atomically:YES];
myschedule.image = editedImage;
[zoomscroll addSubview:myschedule];
zoomscroll.contentSize = CGSizeMake(myschedule.frame.size.width , myschedule.frame.size.height);
zoomscroll.minimumZoomScale = 1.0;
zoomscroll.maximumZoomScale = 4.0;
}
}
谢谢!