UISearchController searchBar showsCancelButton not being respected

后端 未结 12 2500
北荒
北荒 2021-02-13 03:58

I\'ve added a UISearchController to my application and set it\'s searchBar to the titleView of my navigationItem.

This works but I am seeing t

12条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-13 04:27

    my solution was to set the attribute every time anew when I used the searchcontroller respectively its searchbar. I initialized the searchcontroller lazily without setting the attribute and then did

    searchController.searchBar.showsCancelButton = false
    

    every time before search began. You could do this in the UISearchControllerDelegate methods i.e...

提交回复
热议问题