【发布时间】:2012-09-05 03:36:13
【问题描述】:
您好,我是 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];
}
相册中显示
在应用中显示
根据 iSanjay cmets 将 [editingPhotoImgVw setContentMode:UIViewContentModeScaleAspectFit]; 更改为 [editingPhotoImgVw setContentMode:UIViewContentModeScaleToFill];
【问题讨论】:
标签: iphone ios uiimageview camera photolibrary