4

I have a custom view as search bar and set it to Navigation titleView. CustomView is no longer visible on iOS 11 devices alone. I debugged with Hierarchy View and I found that custom view's frame size is (0,0).

This issue happens only on iOS 11, it works fine on iOS 9 and 10.

UIView *searchBarView = [self createSearchBarView];  // Custom searchBarView
self.navigationItem.titleView = searchBarView;
searchBarView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

How can I add custom view as Navigation's titleView on iOS 11?

1 Answers1

4

In your custom UIView overrire below method

override var intrinsicContentSize: CGSize {
   return UILayoutFittingExpandedSize
} 

Check and let me know is it working for your or not ?

Arpit Jain
  • 118
  • 4