CNContactPickerViewController content bleeds to search bar and status bar

555 Views Asked by At

I'm presenting CNContactPickerViewController (strongly referenced ivar):

contactsViewController = [[CNContactPickerViewController alloc] init];
contactsViewController.delegate = self;
[self presentViewController:contactsViewController animated:YES completion:nil];

However, here is the result:

enter image description here

After encountering the problem I've tried changing the appearance of search bar (not sure what I should set, just trying): [[UISearchBar appearanceWhenContainedInInstancesOfClasses:@[[CNContactPickerViewController class]]] setBarTintColor:[UIColor redColor]]; but it didn't do anything.

Why would this happen and how can I fix it?

UPDATE: I've tried various combinations of the following on the contacts view controller:

  • automaticallyAdjustsScrollViewInsets
  • definesPresentationContext
  • edgesForExtendedLayout
  • modalPresentationStyle
  • modalPresentationCapturesStatusBarAppearance

However, nothing changes at all. They all yield the same result.

2

There are 2 best solutions below

0
On BEST ANSWER

I've encountered the same problem on some other remove view controllers too.

I've had some code that set appearances using proxies on app startup, which looked suspicious. I've disabled the code that set appearance proxies on app startup and the problem went away. After investigating, I've found out the culprit:

[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; I was using this for making the navigation bar background completely transparent at some places, though it was something leftover from old designs and weren't needed. I've removed the line and the problem went away.

1
On
UINavigationBar.appearance().isTranslucent = false

Add this line before presenting the contoller.

It worked for me!