Hide UISearchBar Cancel Button

后端 未结 11 882
夕颜
夕颜 2020-12-24 06:39

I have a UISearchDisplayController and UISearchBar hooked up to my ViewController via Outlets from my nib.

I\'d like to hide the cancel button so that the user never

11条回答
  •  我在风中等你
    2020-12-24 07:17

    Similar to Nimrod's answer, you can also subclass UISearchDisplayController and implement the setActive:animated: method:

    - (void)setActive:(BOOL)visible animated:(BOOL)animated {
        [super setActive:visible animated:animated];
        self.searchBar.showsCancelButton = NO;
    }
    

提交回复
热议问题