I've added a search controller using the storyboard and added in the search controller programmatically. I'm having a bit of trouble centering the search bar vertically so that it's not touching the top navigation bar (see photo). How I added the search bar code is posted below.
Any help is appreciated.
self.navigationItem.searchController = self.searchController;
self.navigationItem.hidesSearchBarWhenScrolling = NO;
Simply add a vertical constraint to your search bar as I've done in this image:
You can set the vertical constraint by clicking the tie-fighter like icon at the bottom of XCode. Set your constraint to 8 for example then click the I-bar followed by add 1 constraint: