hello大家我正面临一个问题。 在我的应用程序中,我想剪裁从相机拍摄的图像区域。 因此,我使用的是UIImagePickerController &它是cameraOverlayView。ios UIImagePickerController摄像头覆盖视图的状态栏属性
问题是,在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
许多在此先感谢。 Siarhei