UISearchBar Design glitch on Xcode 11.1

Viewed 85

UISearchBar design results weird when Build with Xcode 11.1.

I created ViewController and presented from another one. UISearchbar is added below to the UINavigationBar via Storyboard.

Build With Xcode 11.0:

Build With Xcode 11.0

Build With Xcode 11.1:

Build With Xcode 11.1

Why it happened? If this should be the behaviour, how to achieve the first design. How to fix it?

1 Answers

As Anbu.Karthik commented, I realised, when compiled in Xcode 11.1, searchTextField's background color to clear color, and we have to set background color explicitly.

Swift:

searchBar.searchTextField.backgroundColor = .white

Obj-C

self.searchBar.searchTextField.backgroundColor = [UIColor whiteColor];
Related