vikzilla
vikzilla

Reputation: 4138

UISearchController not showing on iOS8

I have a UISearchController, whose searchBar is set as my tableView's tableHeaderView:

tableView.tableHeaderView = searchController.searchBar

It's working great on my device that runs iOS9: enter image description here

But when I run it on my device that's running iOS8 there is no search bar. enter image description here

From what I've read, the UISearchController is available for iOS8 and later. So I do not understand why its searchBar does not show up on my iOS8 device.

Upvotes: 10

Views: 2151

Answers (1)

A Trâu
A Trâu

Reputation: 305

UISearchBar is not automatically setting its size add this code:

[searchController.searchBar sizeToFit];

Apple Sample

Upvotes: 23

Related Questions