6 Replies
      Latest reply on Oct 22, 2018 11:54 PM by REVEES
      Neuronical Level 1 Level 1 (0 points)

        Hey,

         

        Am building the new version of an app for iOS 11. Am using the large title setup with native controls to achieve an interaction pretty much the same as the contacts app's main view.

         

        My problem is that when I set the searchController so that the UISearchBar appears in the navigation bar, any appearance or manual setting of the shadowImage on the UINavigationBar gets ignored.

         

        Here are the setters I am using (UIImage withColor is custom helper that returns a resizeable image of given color).

         

        ...
        navigationController.navigationBar.prefersLargeTitles = true
        navigationController.navigationItem.largeTitleDisplayMode = .automatic
        ...
        navigationController.navigationBar.shadowImage = UIImage(withColor: UIColor.white)
        ...
        
        
        

         

        When I set the searchController here (either before or after setting the navigation settings):

         

        searchController = UISearchController(searchResultsController: resultsTableController)
        ...
        navigationItem.searchController = searchController
        navigationItem.hidesSearchBarWhenScrolling = false
        
        
        

         

        The shadow separator image is ignored and a black 0.5pt (or whatever size) shadowImage is shown regardless of if I set it again.

         

        I can't seem to fix this - it's not a dealbreaker - but the design I have want's it not there and I would rather not have to do any hacky subview searching/class from string searching etc to fix it.

         

        Has anyone else had this issue, or know if it is even possible to customize the `shadowImage` property if a `searchController` is set on the `navigationItem`

         

        Cheers,

         

        Michael