0

我正在尝试将上述类别用于UIImage-在这里找到

使用的原因是我让用户使用相机/选择器拍照。然后我需要显示在UIImageView.

我想保留图像的方向信息,但稍微缩小它,以获得性能并最适合图像视图。

我如何实现使用这个类别?我不确定如何调用猫,我是否以某种方式调用该方法?

目前,我有一些选择器的委托方法:

#pragma mark - UIImagePickerDelegate Methods
//delegate methode will be called after picking photo either from camera or library
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    [self dismissViewControllerAnimated:YES completion:nil];

    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];

    self.collectedImage = image;
    NSLog(@"the collect image orientation is: %i",image.imageOrientation);
4

1 回答 1

0
self.collectedImage = image;
NSLog(@"--------------------collected image information----------------------");
NSLog(@"the collected image orientation is: %i",image.imageOrientation);
NSLog(@"the image width is: %f",self.collectedImage.size.width);
NSLog(@"the image height is: %f",self.collectedImage.size.height);

// scale the image
UIImage *newCollectedImage = [self.collectedImage scaleWithMaxDimension:([[UIScreen mainScreen] bounds].size.height)];
self.collectedImage = newCollectedImage;
NSLog(@"--------------------collected NEW image information----------------------");
NSLog(@"the new collected image orientation is: %i",self.collectedImage.imageOrientation);
NSLog(@"the new image width is: %f",self.collectedImage.size.width);
NSLog(@"the new image height is: %f",self.collectedImage.size.height);
于 2013-07-30T12:40:06.153 回答