iOS 13 strange search controller gap

前端 未结 12 1759
无人共我
无人共我 2021-02-01 14:55

When running the App on iOS 13 beta 6, using Xcode 11 beta 5 I\'m encountering the strange gap when presenting search results view controller:

Here\'s a bit o

12条回答
  •  臣服心动
    2021-02-01 15:49

    1. As it was mentioned in above answers, set Extend Edges Under Opaque Bars flag as On for UIViewController which presents search results. For me it was not enough because I use NOT translucent navigation bar.
    2. So I added the following implementation for methods of UISearchControllerDelegate:
        - (void)willPresentSearchController:(UISearchController *)searchController
        {
            if (@available(iOS 13.0, *))
            {
                self.navigationController.navigationBar.translucent = YES;
            }
        }
    
        - (void)willDismissSearchController:(UISearchController *)searchController
        {
            if (@available(iOS 13.0, *))
            {
                self.navigationController.navigationBar.translucent = NO;
            }
        }
    

提交回复
热议问题