gpt4 book ai didi

ios - UIImagePickerController 黑色不透明底栏

转载 作者:可可西里 更新时间:2023-11-01 05:54:42 27 4
gpt4 key购买 nike

我需要我的 View 在拍照时有一个黑色不透明的底部和顶部栏。我希望它看起来完全像这样:

http://imgur.com/Qdbp6fP

这实际上是我在运行 iOS 7 的 iPhone 5 上运行我的代码。但是当我在 iPhone 4S(也是 iOS 7)上编译我的代码时,底部栏变得透明 - View 变成了从上到下的相机底部,就像现在的相机应用程序一样。甚至“拍照”按钮也变得透明,就像 SnapChat 一样。我讨厌这个。我需要更改什么设置才能使底部栏在我的 iPhone 4S 上变得不透明?我正在使用自动布局。

这是在我的 viewDidAppear 中:

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
self.anImagePickerController = [UIImagePickerController new];
self.anImagePickerController.delegate = self;
self.anImagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
self.anImagePickerController.showsCameraControls = YES;

[self presentViewController:self.anImagePickerController animated:NO completion:Nil];
}

最佳答案

下面的代码将完全按照您的要求执行。我自己发现了这一点,因为我想做和你完全一样的事情,并且觉得完全没有必要滚动你自己的相机 Controller 。

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.allowsEditing = YES;
imagePicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
imagePicker.delegate = self;

[self presentViewController:imagePicker animated:YES completion:^()
{
for (UIView *subview in imagePicker.view.subviews)
{
if([NSStringFromClass([subview class]) isEqualToString:@"UINavigationTransitionView"])
{
UIView *theView = (UIView *)subview;

for (UIView *subview in theView.subviews)
{
if([NSStringFromClass([subview class]) isEqualToString:@"UIViewControllerWrapperView"])
{
UIView *theView = (UIView *)subview;

for (UIView *subview in theView.subviews)
{
if([NSStringFromClass([subview class]) isEqualToString:@"PLCameraView"])
{
UIView *theView = (UIView *)subview;

for (UIView *subview in theView.subviews)
{
if([NSStringFromClass([subview class]) isEqualToString:@"CAMTopBar"])
{
subview.backgroundColor = [UIColor blackColor];
}
if([NSStringFromClass([subview class]) isEqualToString:@"CAMBottomBar"])
{
subview.backgroundColor = [UIColor blackColor];
}
if([NSStringFromClass([subview class]) isEqualToString:@"PLCropOverlay"])
{
UIView *theView = (UIView *)subview;

for (UIView *subview in theView.subviews)
{
if([NSStringFromClass([subview class]) isEqualToString:@"PLCropOverlayBottomBar"])
{
UIView *theView = (UIView *)subview;

for (UIView *subview in theView.subviews)
{
if([NSStringFromClass([subview class]) isEqualToString:@"PLCropOverlayPreviewBottomBar"])
{
subview.backgroundColor = [UIColor blackColor];
}
}
}
}
}
}
}
}
}
}
}
}
}];

关于ios - UIImagePickerController 黑色不透明底栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21056949/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com