how to show cancel button of searchbar?

后端 未结 6 1291
深忆病人
深忆病人 2021-02-19 06:11

I want to hide the Navigation Bar of my page when the user start editing on the searchbar, I also want to show a cancel button.
It is done but my cancel button is not access

6条回答
  •  执笔经年
    2021-02-19 06:49

    Use this code for showing cancel button. It will show button when you will enter text in searchBar.

    -(void) searchBarTextDidBeginEditing:(UISearchBar *)searchBar
    {
        [searchBar setShowsCancelButton:YES animated:YES];
    }
    

提交回复
热议问题