UISearchDisplayController gap between overlay and bar

In my application, I am trying to add search functionality. I have a table view controller and a custom top bar view where I show UISearchBar. The problem is that the overlay view is always slightly below the top bar, and it adds a gap between them:

enter image description here

In my table view controller .m file viewDidLoad :

[super viewDidLoad];

LSDropdownViewController *menuCtrl = (LSDropdownViewController *)[self parentViewController];

menuCtrl.topSearchBar.delegate = self;
[menuCtrl.topSearchBar setBackgroundColor:[UIColor clearColor]];
[menuCtrl.topSearchBar setBackgroundImage:[UIImage imageWithGradientColors]];
[menuCtrl.topSearchBar setTintColor:[UIColor whiteColor]];

self.searchController = [[UISearchDisplayController alloc] initWithSearchBar:menuCtrl.topSearchBar contentsController:self];
self.searchController.delegate = self;
self.searchController.searchResultsDataSource = self;
self.searchController.searchResultsDelegate = self;

any ideas?

+4
source share
1 answer

- iOS7+. , , , y- 20 , searchBar.frame = CGRectMake (0,20, , ).

0

Source: https://habr.com/ru/post/1540551/


All Articles