I have embedded a UITabBarController inside a UINavigationController. The UITabBarController contains 3 different tabs which leads to 3 different UIViewControllers which displays UITableView. I implemented all these through storyboard. In the first UIViewController, I have implemented a UISearchController for the UITableView programatically which is working. The View turns black when I search for a particular cell and then if I switch tabs. I believe that the issue has some relation to SearchController because before including the SearchController, I didn't have any issues.
I have gone through few other questions in here, but none could solve my issue.
Edited :
Below is my code related to SearchController.
@interface
@property (nonatomic, strong) UISearchController *searchController;
@property BOOL searchControllerWasActive;
@property BOOL searchControllerSearchFieldWasFirstResponder;
@implementation
viewDidAppear()
self.searchController = [[UISearchController alloc]initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
[self.searchController.searchBar sizeToFit];
self.tblContactsTable.tableHeaderView = self.searchController.searchBar;
self.searchController.delegate = self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.searchBar.delegate = self;
self.definesPresentationContext = YES;
- (void)updateSearchResultsForSearchController:(UISearchController *)searchController
//reloads table view according to what is searched.
-(void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
self.searchController.searchBar.showsCancelButton = NO;
UITabBarController should be the top most element on window from your storyboard/code and you can add the Navigation Controllers and View Controllers to UITabBarController view controllers. https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITabBarController_Class/index.html