1

I am having an issue with UIImagePickerController. I'm presenting as Fullscreen. The issue is the images grid goes behind the navigation bar. I have even tried a new appearance proxy thing but no luck. Here is a link to the video of the issue.

UIImagePickerController issue

If anyone knows anything let me know, please.

Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256

2 Answers2

1

As of iOS 7.0, all views automatically go behind navigation bars, toolbars and tab bars to provide what Apple calls "context" – having some idea of what's underneath the UI (albeit blurred out with a frosted glass effect) gives users an idea of what else is just off screen.

If this is getting in your way (and honestly it does get in the way surprisingly often) you can easily disable it for a given view controller by modifying its edgesForExtendedLayout property.

For example, if you don't want a view controller to go behind any bars, use this:

edgesForExtendedLayout = []

for your case you can use it like this:

yourvc.edgesForExtendedLayout = []

For your reference i am also attaching a link which also answers your question.

Dharmesh Mansata
  • 4,422
  • 1
  • 27
  • 33
Saurabh
  • 222
  • 1
  • 7
  • Why we don't need to set this till iOS 12 ? The issue only appear in iOS 13 – Rahul Vyas Nov 06 '19 at 13:16
  • Even if we need to set this can't we use appearance api for this ? – Rahul Vyas Nov 06 '19 at 13:17
  • This issue appeared has appeared in past as well. I think it was fixed by apple in between and now it's back again so you can check for iOS version using if #available(iOS 13.0, *) {} – Saurabh Nov 06 '19 at 13:21
  • @Rahul If the answer works for you then please upvote it and accept it. – Saurabh Nov 06 '19 at 13:48
  • @property(nonatomic,assign) UIRectEdge edgesForExtendedLayout API_AVAILABLE(ios(7.0)); // Defaults to UIRectEdgeAll – Rahul Vyas Nov 06 '19 at 13:58
  • Do you still think I need to set yourvc.edgesForExtendedLayout = [] ? – Rahul Vyas Nov 06 '19 at 13:59
  • picker.automaticallyAdjustsScrollViewInsets = NO; picker.edgesForExtendedLayout = UIRectEdgeNone; [picker.navigationBar setTranslucent:NO]; Tried setting the above on UIImagePicker but no luck – Rahul Vyas Nov 06 '19 at 14:07
1

I ran into the same issue recently(with iOS13).

The issue to me was resolved by setting UIScrollViewContentInsetAdjustmentAutomatic to [UIScrollView appearance] before present the image picker. Fyi.

    if (@available(iOS 11.0, *)) {
        [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAutomatic];
    }

As there is code which set UIScrollViewContentInsetAdjustmentNever in my project.

Remember resetting the value to be UIScrollViewContentInsetAdjustmentNever after the image picker finished its work.

loongman
  • 74
  • 8