【发布时间】:2011-12-07 04:32:38
【问题描述】:
我已经通过覆盖视图自定义了带有自定义按钮(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) 中运行不佳。谁能帮我解决这个问题?
【问题讨论】:
标签: iphone orientation landscape camera-overlay