1

i found UINavigationBar.height = 56 in iOS11 but UINavigationBar.height = 44 in lower than iOS 11.

my code is here:

UIBarButtonItem *scanButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"scan_code"] style:UIBarButtonItemStylePlain target:self action:@selector(pushScanController)];
self.navigationItem.leftBarButtonItem = scanButton;

there is a location bug in iOS11.

As shown in figure:

enter image description here

enter image description here

How can I fix this bug?

Nirav Kotecha
  • 2,493
  • 1
  • 12
  • 26
Eddiegooo
  • 13
  • 6

1 Answers1

0

It looks like your problem is caused by the search bar being bigger rather than something in the buttons.

You may want to try something like:

if #available(iOS 11.0, *) {
    [[self.yourSearchBar.heightAnchor constraintEqualToConstant:44.0] setActive:YES]
}

Or investigate and implement the iOS 11 search bar changes.

The_Falcon
  • 287
  • 1
  • 2
  • 10
  • According to your code , UI shows there are still a little abnormal. Besides, under the VC transfer to another VC , there will be a UINavigationBar splash screen, because of the next VC UINavigationBar.height = 56. So doing this or not so good. – Eddiegooo Oct 19 '17 at 00:47