简体   繁体   中英

Bad transition between views in navigation bar with search controller (iOS 11)

I use this code to add UISearchController:

    self.searchController.obscuresBackgroundDuringPresentation = YES;
    self.searchController.hidesNavigationBarDuringPresentation = YES;
    self.searchController.searchBar.searchBarStyle = UISearchBarStyleDefault;
    self.navigationItem.searchController = self.searchController;
    self.navigationItem.hidesSearchBarWhenScrolling = NO;

I see that sometimes while transition between views when searchBar goes upwards dark background appears underneath. I tried many things but can't figure out why it's happens. Any idea why it happens?

Thanks

I also encountered this problem recently. Check the background color of the navigation controller your view controller is embedded in. Is should be the same color as bar tint color, of the color of your view controller's background view. Anything but clear color. Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM