嗨,我是iOS的新手。
我正在开发一个应用程序,它包含照片编辑功能。为此,我可以从照片库中选择照片。我可以成功地选择照片并将其放置在UIImageView。中,但是我觉得它不是那么好。它与相册中显示和UIImageView中显示有很多不同。
我希望像在相册中一样显示它。我怎样才能做到这一点?
请指导我。
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *originalImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSLog(@"size of originalImage is %@",NSStringFromCGSize(originalImage.size));
editingPhotoImgVw.frame = CGRectMake(0, 0, 320,self.view.frame.size.height);
editingPhotoImgVw.image =originalImage;
[editingPhotoImgVw setContentMode:UIViewContentModeScaleAspectFit];
[self.view addSubview:editingPhotoImgVw];
[self dismissModalViewControllerAnimated:YES];
[picker release];
}
在相册中显示
在应用程式中显示
更改后[editingPhotoImgVw setContentMode:UIViewContentModeScaleAspectFit];进入[editingPhotoImgVw setContentMode:UIViewContentModeScaleToFill];根据iSanjay的评论
最佳答案
您正在使用图像内容模式
[editingPhotoImgVw setContentMode:UIViewContentModeScaleAspectFit];
代替这个尝试
[editingPhotoImgVw setContentMode:UIViewContentModeScaleToFill];
做这个 。