Search code examples
iosios7uisearchbaruisearchbardelegate

iOS7 UISearchBar cancel button text not showing. Button appears invisible


I am hoping this is an easy question.

enter image description here

I have a search bar that shows a cancel button:

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

Only problem is that the text on the cancel button isn't showing.

enter image description here

The button is obviously there because I can click on it but no text appears when the button is shown. Its as if the button is invisible. The code worked fine in iOS6 but now in iOS7 I am having this problem. Any body have any ideas? I am using a UISplitViewController and my search bar is in the navigationItem.titleView of the MasterViewController.


Solution

  • Probably You got clear tint color, it's the only reason I could imaging try to set

    _searchBar.tintColor = [UIColor redColor];

    How do You create UISearchBar?