JimZ
JimZ

Reputation: 1202

iOS 7, scope bar becomes black in search mode

I use UISearchDisplayController embedded to UiTableViewController to make a search bar in my table view. But if I set the search bar's background image, the scope bar do not show in search mode, but showing a black bar instead. It's very weird because it does not happen in iOS 6.

Note that the image I used to set the search bar's background image is 640x90 px, somehow the scope bar will show if use other image.

Even if I set the scope bar background image, it sill not show depend on the search bar's image setting.

I think it's a bug in iOS 7, and to prevent from other factors, I even use the master-detail template in Xcode 5, and embed the UISearchDisplayController in master view controller, change the search bar background image and scope bar shows black in search mode.

I think it has something to do with iOS 7 auto resize of view controller. Bothers me so much.

Someone please try and help. Thanks a lot a lot.

------------------------------edited-------------------------- Sometimes the scope bar will show if I change search bar background image, but in real device (iPhone5), the scope bar never show.

Upvotes: 3

Views: 1268

Answers (2)

weet1988
weet1988

Reputation: 314

I have resolved this problem by using UISearchBar appearance:

[[UISearchBar appearance] setBackgroundImage:bgImage forBarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsDefault];

Upvotes: 0

PiXy
PiXy

Reputation: 631

I have just found a solution here: IOS7 Status bar change to black after search is active

Just put these two lines on your table view controller (viewDidLoad):

self.navigationController.view.backgroundColor = [UIColor whiteColor]; 

self.navigationController.navigationBar.translucent = NO;

Where "whiteColor" is the color that you need for the status Bar.

Upvotes: 2

Related Questions