|
@@ -316,6 +316,9 @@
|
|
|
// Refresh control
|
|
|
_refreshControl.tintColor = [NCBrandColor sharedInstance].brand;
|
|
|
|
|
|
+ // color searchbar
|
|
|
+ self.searchController.searchBar.barTintColor = [NCBrandColor sharedInstance].brand;
|
|
|
+
|
|
|
// Reload Table View
|
|
|
[self tableViewReloadData];
|
|
|
}
|
|
@@ -1858,59 +1861,23 @@
|
|
|
- (void)searchEnabled:(BOOL)enabled
|
|
|
{
|
|
|
if (enabled) {
|
|
|
+
|
|
|
+ if (self.tableView.tableHeaderView != nil)
|
|
|
+ return;
|
|
|
|
|
|
- if (@available(iOS 11, *)) {
|
|
|
-
|
|
|
- if (self.navigationItem.searchController != nil)
|
|
|
- return;
|
|
|
-
|
|
|
- self.definesPresentationContext = YES;
|
|
|
- self.searchController.searchResultsUpdater = self;
|
|
|
- self.searchController.dimsBackgroundDuringPresentation = NO;
|
|
|
- self.searchController.searchBar.barTintColor = [NCBrandColor sharedInstance].seperator;
|
|
|
- [self.searchController.searchBar sizeToFit];
|
|
|
- self.searchController.searchBar.delegate = self;
|
|
|
-
|
|
|
- self.navigationItem.searchController = self.searchController;
|
|
|
- self.navigationItem.hidesSearchBarWhenScrolling = true;
|
|
|
- self.navigationItem.searchController.searchBar.tintColor = [UIColor whiteColor];
|
|
|
+ self.definesPresentationContext = YES;
|
|
|
+ self.searchController.searchResultsUpdater = self;
|
|
|
+ self.searchController.dimsBackgroundDuringPresentation = NO;
|
|
|
+ self.searchController.searchBar.barTintColor = [NCBrandColor sharedInstance].brand;
|
|
|
+ [self.searchController.searchBar sizeToFit];
|
|
|
+ self.searchController.searchBar.delegate = self;
|
|
|
|
|
|
- UITextField *textField = [self.searchController.searchBar valueForKey:@"searchField"];
|
|
|
- textField.textColor = [UIColor blackColor];
|
|
|
- textField.tintColor = [UIColor blackColor];
|
|
|
-
|
|
|
- UIView *backgroundView = textField.subviews.firstObject;
|
|
|
- backgroundView.backgroundColor = UIColor.whiteColor;
|
|
|
- backgroundView.layer.cornerRadius = 10;
|
|
|
- backgroundView.clipsToBounds = YES;
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- if (self.tableView.tableHeaderView != nil)
|
|
|
- return;
|
|
|
-
|
|
|
- self.definesPresentationContext = YES;
|
|
|
- self.searchController.searchResultsUpdater = self;
|
|
|
- self.searchController.dimsBackgroundDuringPresentation = NO;
|
|
|
- self.searchController.searchBar.barTintColor = [NCBrandColor sharedInstance].seperator;
|
|
|
- [self.searchController.searchBar sizeToFit];
|
|
|
- self.searchController.searchBar.delegate = self;
|
|
|
-
|
|
|
- self.tableView.tableHeaderView = self.searchController.searchBar;
|
|
|
- [self.tableView setContentOffset:CGPointMake(0, self.searchController.searchBar.frame.size.height - self.tableView.contentOffset.y)];
|
|
|
- }
|
|
|
+ self.tableView.tableHeaderView = self.searchController.searchBar;
|
|
|
+ [self.tableView setContentOffset:CGPointMake(0, self.searchController.searchBar.frame.size.height - self.tableView.contentOffset.y)];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- if (@available(iOS 11, *)) {
|
|
|
-
|
|
|
- self.navigationItem.searchController = nil;
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- self.tableView.tableHeaderView = nil;
|
|
|
- }
|
|
|
-
|
|
|
+ self.tableView.tableHeaderView = nil;
|
|
|
}
|
|
|
}
|
|
|
|