如何在IOS 6中将风景图像转换为肖像图像?

时间:2013-07-31 10:48:55

标签: iphone objective-c ios6 uiimage uiimagepickercontroller

我正尝试在风景模式下从相机拍照,我想在 iOS6 中以人像模式显示该图像。我无法以纵向模式旋转图像。

1 个答案:

答案 0 :(得分:0)

你想旋转,然后你要用旋转的图像做什么? 如果您只想在视图中显示它,请将其包装在UIImageView中,旋转imageView并插入视图:

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage* image = [[info objectForKey: UIImagePickerControllerOriginalImage] fixOrientation];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    imageView.transform = CGAffineTransformMakeRotation(M_PI * 90 / 180);
    [self.view addSubview:imageView];
}