iOS 7 UIImagePickerController导航栏重叠 [英] iOS 7 UIImagePickerController navigationbar overlap
本文介绍了iOS 7 UIImagePickerController导航栏重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在iOS7中访问照片库遇到了问题(iOS6没关系)。似乎导航栏与相册视图重叠,我试图设置 picker.edgesForExtendedLayout = UIRectEdgeNone;
但它不起作用。
I ran into a problem accessing photo library in iOS7 (iOS6 is OK). It seems navigation bar overlaps the photo album view, I tried to set picker.edgesForExtendedLayout = UIRectEdgeNone;
but it doesn't work.
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];
查看我的截图
推荐答案
这对我有用:
UIImagePickerController set selucent = NO to navigation Bar
UIImagePickerController set translucent = NO to navigation Bar
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.navigationController.navigationBar.translucent = NO;
在此之后,在您的UIImagePickerController委托中实现此代码:
After this, implement this code in your UIImagePickerController delegate:
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
if ([navigationController isKindOfClass:[UIImagePickerController class]])
{
viewController.navigationController.navigationBar.translucent = NO;
viewController.edgesForExtendedLayout = UIRectEdgeNone;
}
}
这篇关于iOS 7 UIImagePickerController导航栏重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文