iPhone的横向模式下不显示相机叠加视图

时间:2011-11-16 06:02:58

标签: iphone ios4 uiimagepickercontroller

我使用UIImagePickerViewController& amp;试图覆盖另一个视图。我已经设置了横向模式的叠加视图但是在叠加到摄像机视图后它仍然以纵向模式显示。

2 个答案:

答案 0 :(得分:0)

我通过旋转叠加视图解决了这个问题,如下所示:tmpCamera.cameraOverlayView.transform = CGAffineTransformRotate(CGAffineTransformIdentity,117.81);希望这能节省时间:)

答案 1 :(得分:0)

   first you selected only potrait mode in app settting
then use this function in viewdidLoad
//Orientation View into LandScape Mode
    -(void)orientationToLandscape{
        CGAffineTransform rotateTransform;
        switch ([UIApplication sharedApplication].statusBarOrientation) {
            case UIInterfaceOrientationPortrait:
                rotateTransform = CGAffineTransformMakeRotation(-90*M_PI/180.0);
                break;
            case UIInterfaceOrientationPortraitUpsideDown:
                rotateTransform = CGAffineTransformMakeRotation(90*M_PI/180.0);
                break;

            default:
                rotateTransform = CGAffineTransformMakeRotation(0);
                break;
        }

        rotateTransform = CGAffineTransformTranslate(rotateTransform, +90.0, +90.0);
        [self.view setTransform:rotateTransform];


    }