Q
自定义搜索栏
0
A
回答
2
self.searchBar
是IBOutlet
。您也可以动态创建它。
self.searchBar.layer.borderWidth = 2.0;
self.searchBar.layer.borderColor = [UIColor brownColor].CGColor;
self.searchBar.layer.cornerRadius = 15.0;
self.searchBar.barTintColor = [UIColor colorWithRed:255/255.0 green:246/255.0 blue:241/255.0 alpha:1.0];
self.searchBar.backgroundColor = [UIColor clearColor];
UITextField *textField = [self.searchBar valueForKey:@"_searchField"];
textField.textColor = [UIColor brownColor];
textField.placeholder = @"Search";
textField.leftViewMode = UITextFieldViewModeNever; //hiding left view
textField.backgroundColor = [UIColor colorWithRed:255/255.0 green:246/255.0 blue:241/255.0 alpha:1.0];
textField.font = [UIFont systemFontOfSize:18.0];
[textField setValue:[UIColor brownColor] forKeyPath:@"_placeholderLabel.textColor"];
UIImageView *imgview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 30)];
imgview.image = [UIImage imageNamed:@"searchIcon.png"]; //you need to set search icon for textfield's righ view
textField.rightView = imgview;
textField.rightViewMode = UITextFieldViewModeAlways;
输出:
0
你可以用图像来改变UISearchBar
appearance-
[[UISearchBar appearance] setBackgroundColor:[UIColor clearColor]];
[[UISearchBar appearance] setBackgroundImage:[UIImage imageNamed:@"searchBG.png"]];
[[UISearchBar appearance] setSearchFieldBackgroundImage:[UIImage imageNamed:@"search.png"] forState:UIControlStateNormal];
0
你可以使用一些定制的解决方案(这是定制更好) 例如SSSearchBar或试图找到一些类似
相关问题
- 1. 自定义搜索栏searchIcon
- 2. Android自定义搜索栏
- 3. NoSuchMethodException自定义搜索栏
- 4. 如何显示自定义搜索栏?
- 5. UISplitView Ipad自定义搜索栏
- 6. 创建自定义搜索栏
- 7. 创建自定义搜索栏
- 8. 带边框的自定义搜索栏
- 9. iOS中的自定义搜索栏
- 10. 使用搜索栏自定义UITableView
- 11. 自定义搜索栏在Android的
- 12. 指标设计自定义搜索栏
- 13. 自定义搜索栏View实现
- 14. 我的自定义主页上的自定义搜索栏
- 15. 在ActionBarSherlock搜索栏中制作自定义搜索建议
- 16. 带自定义搜索框的Google自定义搜索?
- 17. 自定义谷歌自定义搜索
- 18. 导航栏自定义高度与右侧的搜索栏
- 19. 如何使用自己的CSS自定义Google自定义搜索栏API
- 20. Bootstrap自定义搜索Google搜索
- 21. 自定义搜索实施
- 22. 自定义的Plone搜索
- 23. 搜索自定义tableviewCell
- 24. 谷歌自定义搜索
- 25. 自定义搜索结果
- 26. CakePHP的自定义搜索
- 27. 搜索自定义对象
- 28. WordPress的自定义搜索
- 29. android自定义搜索
- 30. Google自定义搜索
什么是你的搜索栏样式使用理查兹后码? –
风格默认@ Dev.RK – iDeveloper