Hide UISearchBar in UITableView with multiple lines

The known solutions for hiding the UISearchBar do not work if the table contains only a few rows. For example,

 [self.companiesAndContatsTableView setContentOffset:CGPointMake(0, 44)];

      

will only work if the number of cells in the table exceeds the number of rows that fit on the screen. I want to hide the search bar in every situation - especially when the table contains only a few rows and the user doesn't need search functionality.

I tried to add something like:

self.companiesAndContatsTableView.contentInset = UIEdgeInsetsMake(-44, 0,0, 0);

      

but I am not allowed to move my alphabet index position from the right side.

enter image description here

+3


source to share





All Articles