我通过叠加视图使用自定义按钮(UIButton)自定义了相机。我的 iPhone 应用程序只能在横向模式(左右)下运行。现在,我的相机覆盖视图在 iPhone 3GS 中左右完美地改变了它的方向,但在 iPhone4 中运行不清晰。在 ios5 中,如果我以横向模式(右/左)启动带有覆盖视图的相机,它会完美启动,但是,如果我将方向更改为(右 -> 左/左 -> 右),则覆盖视图不会完全改变帧大小UIView(CameraOverlayView),UIButton 框架大小正在改变。我该如何解决?请帮我解决这个问题。我希望你我的朋友解决我的问题。提前致谢。在这里,我附上了我使用的代码。
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if(orientation == UIDeviceOrientationLandscapeLeft)
{
CGAffineTransform transform = self.view.transform;
transform = CGAffineTransformRotate(transform, (M_PI / 2.0));
imgpicker.cameraOverlayView.transform = transform;
NSLog(@"Orientation Landscape Left");
}
else if(orientation == UIDeviceOrientationLandscapeRight)
{
imgpicker.cameraOverlayView.transform = CGAffineTransformRotate(CGAffineTransformIdentity, 117.81);
NSLog(@"Orientation Landscape Right");
}
此代码在 iPhone#GS(ios4) 中运行良好,但在 iPhone4(ios5) 中运行良好。谁能帮我解决这个问题?