0

で画像の回転を管理しようとしてimagePickerController:didFinishPickingMediaWithInfoいますが、何度か試みた後、解決策が見つかりませんでした。私の最後の試みは:

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

        // load the storyboard by name
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:[ApplicationSupport getStoryBoardName] bundle:nil];
        UploadViewController *uploadView = [storyboard instantiateViewControllerWithIdentifier:@"ViewUploadFile"];

        UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage];
        NSDictionary *metadataImage = [info valueForKey:UIImagePickerControllerMediaMetadata];

        uploadView.imageToUpload = image;

        if([[metadataImage objectForKey:@"Orientation"] intValue] == 3) {
            UIImage *imageRotated = [UIImage imageWithCGImage:[image CGImage] scale:[image scale] orientation:UIImageOrientationDown];
            uploadView.dataToUpload = UIImagePNGRepresentation(imageRotated);
        } else {
            uploadView.dataToUpload = UIImagePNGRepresentation(image);
        }

        // ETC...
    }

使えませんし、使いたくありませんJPEGRepresentation。iPad が特定の位置にあるときに、写真を 180° 回転する必要があります。

何か案が?

4

2 に答える 2

0

UploadView.DataToUpload = [UIImage imageWithCGImage:[画像 CGImage] scale:1.0 orientation : UIImageOrientationDown];

180度回転用。

于 2013-05-07T08:52:59.587 に答える