9

I have a UISearchBar linked with a UISearchDisplayController in the header of a UITableView in iOS7.

I set the UISearchBar with the style minimal. When the searchdisplaycontroller shows his table it has the behavior of the picture below. The table is scrolling above the searchbar. When I switch the style of the tableview to Prominent the table scrolls under the searchbar as expected.

Is this a bug or this behavior is expected?

UITableView with UISearchBar style minimal

Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
flopes
  • 1,345
  • 1
  • 14
  • 21

4 Answers4

5

The text isn't floating above the search bar, it's going below. Minimal style doesn't provide a background so this is expected. It will, however, provide a background during activation if there is a navigation bar present (Minimal style really wants to be over either no content or blurred content).

You are free to add your own custom background if you'd like.

MyztikJenz
  • 1,650
  • 14
  • 19
  • I added a white background. It works partially, the status bar continues transparent. Look at Music app to a example. – flopes Sep 19 '13 at 19:56
  • 1
    Did you add a background for UIBarPositionTopAttached as well as UIBarPositionTop? – MyztikJenz Sep 19 '13 at 23:25
  • 2
    Thank you very much. The code that works: `[searchBar setBackgroundImage:[UIImage imageNamed:@"backgroundImage"] forBarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsDefault]`; – flopes Sep 20 '13 at 10:45
3

Try with self.edgesForExtendedLayout = UIRectEdgeNone; in viewDidLoad method. It works for me.

robygam
  • 51
  • 2
0

I think this issue may for the Auto-Layout or Auto-Resizing. Just check in the nib file in insppector view.

user1673099
  • 3,293
  • 7
  • 26
  • 57
0

Make the x=0 and y=0 for search bar and for tableview x=0 and y=44 , now you will get the tableview below the searchbar.

user2021443
  • 209
  • 2
  • 2