草庐IT

UIsearchBar

全部标签

ios - 无法更改搜索栏背景颜色

我有一个搜索栏:letsearchBar:UISearchBar=UISearchBar(frame:CGRectMake((searchView.frame.width-UIScreen.mainScreen().bounds.width/1.6)/2,0,UIScreen.mainScreen().bounds.width/1.6,24))我想更改文本输入部分的背景颜色。为此,我尝试了:searchBar.barTintColor=UIColor(red:0/255,green:74/255,blue:103/255,alpha:1)searchBar.backgroundColo

ios - 无法更改搜索栏背景颜色

我有一个搜索栏:letsearchBar:UISearchBar=UISearchBar(frame:CGRectMake((searchView.frame.width-UIScreen.mainScreen().bounds.width/1.6)/2,0,UIScreen.mainScreen().bounds.width/1.6,24))我想更改文本输入部分的背景颜色。为此,我尝试了:searchBar.barTintColor=UIColor(red:0/255,green:74/255,blue:103/255,alpha:1)searchBar.backgroundColo

ios - 如何在单击“取消”按钮时退出搜索?

我有一个带有取消按钮的搜索栏。但是当我点击取消按钮时,它不会关闭搜索栏。我怎样才能在点击取消时将搜索栏返回到第一个状态?如果你有任何问题,请问我 最佳答案 您需要实现UISearchBarDelegate:classViewController:UIViewController,UISearchBarDelegate{@IBOutletweakvarsearchBar:UISearchBar!将搜索栏代理设置为自己overridefuncviewDidLoad(){super.viewDidLoad()searchBar.shows

ios - 如何在单击“取消”按钮时退出搜索?

我有一个带有取消按钮的搜索栏。但是当我点击取消按钮时,它不会关闭搜索栏。我怎样才能在点击取消时将搜索栏返回到第一个状态?如果你有任何问题,请问我 最佳答案 您需要实现UISearchBarDelegate:classViewController:UIViewController,UISearchBarDelegate{@IBOutletweakvarsearchBar:UISearchBar!将搜索栏代理设置为自己overridefuncviewDidLoad(){super.viewDidLoad()searchBar.shows

ios - 在 Swift 中更改搜索栏占位符文本字体

我正在尝试更改搜索显示Controller中搜索栏中占位符文本的字体。我正在查看一些示例并尝试实现它们,但由于它们在Objective-C中,我无法找到任何可以开始工作的示例。例如,我试过这个:UITextField*textField=[[searchBarsubviews]objectAtIndex:1];[textFieldsetFont:[UIFontfontWithName:@"Helvetica"size:40]];但我无法通过vartextField:UITextField=UISearchBar有什么想法吗? 最佳答案

ios - 在 Swift 中更改搜索栏占位符文本字体

我正在尝试更改搜索显示Controller中搜索栏中占位符文本的字体。我正在查看一些示例并尝试实现它们,但由于它们在Objective-C中,我无法找到任何可以开始工作的示例。例如,我试过这个:UITextField*textField=[[searchBarsubviews]objectAtIndex:1];[textFieldsetFont:[UIFontfontWithName:@"Helvetica"size:40]];但我无法通过vartextField:UITextField=UISearchBar有什么想法吗? 最佳答案

ios - Swift:UISearchBar:单击搜索按钮时获取文本

我正在尝试使用Swift来学习它,但现在我无法从UISearchBar获取文本现在我的代码是这样的:importUIKitclassSecondViewController:UIViewController{@IBOutletvarmyWebView:UIWebView@IBOutletvaradressbar:UISearchBaroverridefuncviewDidLoad(){super.viewDidLoad()adressbar.showsScopeBar=truevarurl=NSURL(string:"http://google.com")varrequest=NSUR

ios - Swift:UISearchBar:单击搜索按钮时获取文本

我正在尝试使用Swift来学习它,但现在我无法从UISearchBar获取文本现在我的代码是这样的:importUIKitclassSecondViewController:UIViewController{@IBOutletvarmyWebView:UIWebView@IBOutletvaradressbar:UISearchBaroverridefuncviewDidLoad(){super.viewDidLoad()adressbar.showsScopeBar=truevarurl=NSURL(string:"http://google.com")varrequest=NSUR

iOS8 无法隐藏 UISearchController 中搜索栏上的取消按钮

我的目标是防止取消按钮出现在UISearchController的搜索栏中。我从Apple'sTableSearchwithUISearchControllersamplecode开始并隐藏取消按钮,如下面的代码片段所示。但是,当用户点击文本字段时,取消按钮仍然出现。有帮助吗?overridefuncviewDidLoad(){super.viewDidLoad()resultsTableController=ResultsTableController()searchController=UISearchController(searchResultsController:resul

iOS8 无法隐藏 UISearchController 中搜索栏上的取消按钮

我的目标是防止取消按钮出现在UISearchController的搜索栏中。我从Apple'sTableSearchwithUISearchControllersamplecode开始并隐藏取消按钮,如下面的代码片段所示。但是,当用户点击文本字段时,取消按钮仍然出现。有帮助吗?overridefuncviewDidLoad(){super.viewDidLoad()resultsTableController=ResultsTableController()searchController=UISearchController(searchResultsController:resul