【问题标题】:ios UIImagePickerController Camera Overlay view's status bar propertiesios UIImagePickerController Camera Overlay 视图的状态栏属性
【发布时间】:2013-08-19 10:54:21
【问题描述】:

大家好,我面临一个问题。 在我的应用程序中,我想裁剪从相机拍摄的图像区域。 因此,我使用的是 UIImagePickerController 和它的 cameraOverlayView。

问题是在 iPhone 4S、iPad、iPod 上 - “状态栏”不透明。 在第二台 iPad 上,相机中的“状态栏”是透明的。 不知道如何访问 UIImagePickerController 的状态栏?

在我的代码中,我进行了一些高度计算,以防透明,我错误地减去了额外的大小。而且我无法弄清楚“拍摄区域”内图像的大小。

这里有一些代码:

+(CGFloat) statusBarYSize
{
    CGSize statusBarSize = [[UIApplication sharedApplication] statusBarFrame].size;
    return MIN(statusBarSize.width, statusBarSize.height);
}

+(CGRect)maxRectForPicker:(UIImagePickerController*)picker
{
    CGRect maxFrame = picker.cameraOverlayView.frame;
#warning @"Check that coefficient is equal to such value everywhere...)"
    if (!picker.toolbar.translucent) 
        maxFrame.size.height -=([self statusBarYSize]*2.5); // If transparent should not be subtracted!
    return maxFrame;
}

以下是图片链接:

iPhone 的图像。相机具有全屏尺寸 - 状态栏。

https://www.dropbox.com/s/7b405h5cavrf819/CorrectSubstraction.jpg

iPad 的图像。摄像头占据整个屏幕。

https://www.dropbox.com/s/7rekl8xen1z3s9b/ShouldNotSubstract.jpg

提前非常感谢。 夏尔黑

【问题讨论】:

    标签: ios camera uiimagepickercontroller uistatusbar


    【解决方案1】:

    我通过以下方式找到解决方案:而不是试图找出属性。我计算来自相机的图像的纵横比和屏幕的纵横比。之后,我重新缩放图像以保持原生纵横比。它可以让我找到相机标准条的高度。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-21
      • 1970-01-01
      • 2014-09-12
      • 2014-11-13
      • 2015-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多