ios – UIImagePickerController黑色不透明底栏

拍摄照片时,我需要看到黑色不透明的底部和顶部条形图.我希望它看起来完全像这样:

http://imgur.com/Qdbp6fP

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

这是在我的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];
    }

最佳答案 下面的代码将完全符合您的要求.我自己发现了这一点,因为我想要做与你完全相同的事情,并且觉得滚动自己的相机控制器是完全没必要的.

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];
                                                  }
                                              }
                                          }
                                      }
                                  }
                              }
                          }
                      }
                 }
             }
         }
     }
}];
点赞