iOS 7 UIImagePickerController导航栏重叠

Jun*_*Jun 4 uiimagepickercontroller ios ios7

我在iOS7中访问照片库时遇到了问题(iOS6没关系).似乎导航栏与相册视图重叠,我试图设置picker.edgesForExtendedLayout = UIRectEdgeNone;但它不起作用.

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
    picker.edgesForExtendedLayout = UIRectEdgeNone;
}

[self presentViewController:picker animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

看看我的截图

在此输入图像描述

小智 7

这对我有用:

UIImagePickerController将半透明= NO设置为导航栏

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

imagePicker.navigationController.navigationBar.translucent = NO;
Run Code Online (Sandbox Code Playgroud)

在此之后,在您的UIImagePickerController委托中实现此代码:

- (void)navigationController:(UINavigationController *)navigationController
      willShowViewController:(UIViewController *)viewController
                    animated:(BOOL)animated
{
    if ([navigationController isKindOfClass:[UIImagePickerController class]])
    {        
        viewController.navigationController.navigationBar.translucent = NO;
        viewController.edgesForExtendedLayout = UIRectEdgeNone;
    }
}
Run Code Online (Sandbox Code Playgroud)