From 6f5e48efa84abb1fb180df385e57962e75548b27 Mon Sep 17 00:00:00 2001 From: iphone5solo <499491531@qq.com> Date: Thu, 16 Nov 2017 14:56:26 +0800 Subject: [PATCH] Fixed a blank question at the bottom of searchSuggestionView on iOS 11 Fixed a blank question at the bottom of searchSuggestionView on iOS 11 --- PYSearch/PYSearchSuggestionViewController.m | 4 ++++ PYSearch/PYSearchViewController.m | 1 + 2 files changed, 5 insertions(+) diff --git a/PYSearch/PYSearchSuggestionViewController.m b/PYSearch/PYSearchSuggestionViewController.m index b7eb406..7b2d929 100644 --- a/PYSearch/PYSearchSuggestionViewController.m +++ b/PYSearch/PYSearchSuggestionViewController.m @@ -83,6 +83,10 @@ - (void)setSearchSuggestions:(NSArray *)searchSuggestions self.tableView.contentInset = self.originalContentInsetWhenKeyboardHidden; } self.tableView.contentOffset = CGPointMake(0, -self.tableView.contentInset.top); + + if (@available(iOS 11.0, *)) { + self.tableView.contentInset = UIEdgeInsetsMake(-30, 0, 0, 0); + } } #pragma mark - Table view data source diff --git a/PYSearch/PYSearchViewController.m b/PYSearch/PYSearchViewController.m index e2f0d4d..a565a47 100755 --- a/PYSearch/PYSearchViewController.m +++ b/PYSearch/PYSearchViewController.m @@ -345,6 +345,7 @@ - (void)setup [cancleButton setTitle:[NSBundle py_localizedStringForKey:PYSearchCancelButtonText] forState:UIControlStateNormal]; [cancleButton addTarget:self action:@selector(cancelDidClick) forControlEvents:UIControlEventTouchUpInside]; [cancleButton sizeToFit]; + cancleButton.py_width += PYSEARCH_MARGIN; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:cancleButton]; /** * Initialize settings