iOS7 UISearchBar取消按钮文本未显示.按钮看起来不可见

Sco*_*ser 5 uisearchbar uisearchbardelegate ios ios7

我希望这是一个简单的问题.

在此输入图像描述

我有一个显示取消按钮的搜索栏:

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar{
    [searchBar setShowsCancelButton:YES animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

唯一的问题是取消按钮上的文字没有显示.

在此输入图像描述

按钮显然是因为我可以点击它,但显示按钮时没有文字出现.它好像按钮是不可见的.代码在iOS6中运行良好但现在在iOS7中我遇到了这个问题.有什么想法?我正在使用UISplitViewController,我的搜索栏位于MasterViewController的navigationItem.titleView中.

in.*_*see 8

可能你有明显的色调,这是我成像尝试设置的唯一原因

_searchBar.tintColor = [UIColor redColor];

你如何创建UISearchBar?


Bot*_*Bot 5

我不知道它是苹果或预期的错误,但在navigationController中似乎没有显示取消按钮.尝试将搜索栏添加到视图中,然后再将其添加到导航控制器.

UIView *searchBarView = [[UIView alloc] initWithFrame:[searchBar bounds]];
[searchBarView addSubview:searchBar];
self.navigationItem.titleView = searchBarView;
Run Code Online (Sandbox Code Playgroud)