相机覆盖视图在iPhone的横向模式下不显示



我已经使用UIImagePickerViewController &试图覆盖另一个视图。我已经将覆盖视图设置为风景模式,但是在覆盖到相机视图后,它仍然显示为肖像模式。

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

   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];

    }

最新更新