1. Changing the title of the “cancel” button
If you want to localize your UISearchBar or just want to apply a unique text matching your application just implement the following UISearchDisplayControllerDelegate method:
-(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller{
[searchBar setShowsCancelButton:YES animated:NO];
for(UIView *subView in searchBar.subviews){
if([subView isKindOfClass:[UIButton class]]){
[(UIButton*)subView setTitle:@"myCustomTitle" forState:UIControlStateNormal];
}
}
}
2. Changing the title of the “no results” label
Again you need to implement a delegate method
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString{
for(UIView *subview in searchController.searchResultsTableView.subviews) {
if([subview isKindOfClass:[UILabel class]]) {
[(UILabel*)subview setText:@"my custom 'no results' text"];
}
}
return YES;
}
3. Custom background image
Insert this snippet directly after you initialized your UISearchBar
searchBarOverlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"SearchBarBack"]];
searchBarOverlay.frame = CGRectMake(-8, -2, 320, 48);
[searchBar addSubview:searchBarOverlay];
[searchBar sendSubviewToBack:searchBarOverlay];
for (UIView *v in [searchBar subviews]) {
if ([NSStringFromClass([v class]) isEqualToString:@"UISearchBarBackground"])
{
[searchBar sendSubviewToBack:v];
}
if ([NSStringFromClass([v class]) isEqualToString:@"UIImageView"] && v != searchBarOverlay)
{
[searchBar sendSubviewToBack:v];
}
}
5.Custom background color
Finally a one-liner
searchBar.tintColor = [UIColor redColor];
分享到:
相关推荐
综上所述,《嵌入式Android - Porting, Extending and Customizing》这本书不仅深入浅出地讲解了如何将Android系统移植到各种嵌入式设备上,还提供了大量的实践案例和实用技巧,对于希望在这个领域有所作为的专业...
【SAP Customizing Documentation】是SAP系统实施过程中的一个重要环节,主要涉及到对SAP系统的配置和定制,以适应企业的具体业务需求。SAP作为全球领先的企业资源规划(ERP)软件,提供了广泛的模块来覆盖不同行业...
Customizing the Microsoft dot NET Framework Common Language Runtime
### 嵌入式Android移植、扩展与定制 #### 知识点概览 1. **嵌入式Android概述** 2. **移植Android系统至不同硬件平台** 3. **定制化Android系统的方法** 4. **扩展Android功能的技术** 5. **Android构建系统的深入...
总之,《LO650 Cross-Functional Customizing in SD》是SAP专业人士不可或缺的知识点集合,它将帮助企业构建一个高效、灵活且适应性强的销售与分销环境,以支持其业务的持续发展。通过深入学习和实践,学员不仅可以...
Customizing Materials Management with SAP ERP Operations by Akash Agrawal SAP PRESS, 1st edition 2009-08-30 1592292801 9781592292806 English 450
Visual QuickProject Guide: Customizing Windows XP <br> By John Rizzo Publisher: Peachpit Press Pub Date: March 03, 2005 ISBN: 0-321-32124-3 Pages: 144 <br> Every ...
### SAP SD SCM605 Cross Functional Customizing:深入解析 #### 一、SAP SD Cross-Functional Customizing概述 在SAP系统中,模块化设计是其核心特点之一,而跨功能自定义(Cross-Functional Customizing)则是...
本书《RibbonX: Customizing the Office 2007 Ribbon》由Wiley Publishing, Inc.出版,作者包括Robert Martin、Ken Puls以及Teresa Hennig,其主要内容围绕着如何定制Office 2007中的Ribbon界面。Ribbon界面自Office...
标题和描述中提到的《Embedded Android Porting, Extending, and Customizing》是一本与嵌入式Android移植、扩展和定制相关的专业书籍。这本书被视为创建基于Android系统的系统开发者的重要参考资源。由于本书不是由...
### 编程与定制PIC微控制器 #### 一、引言 《编程与定制PIC微控制器》是由迈克·普雷德科(Myke Predko)编写的经典教程,本书适用于不同水平的学习者,旨在帮助读者掌握使用Microchip公司的PIC微控制器进行编程的...
《EWM120_EN_Col17_Customizing Additional Topics in EWM》是关于SAP扩展仓库管理(EWM)的参与者手册,专注于定制额外的主题。该课程版本为17,针对讲师引导的培训设计,课程时长为17小时30分钟。教材编号为...
Customizing Components using Templates demo for Microsoft Graph Toolkit courses.
.Net的进阶图书
在SAP CRM(客户关系管理)系统中,Customizing是一个至关重要的环节,它涉及到系统配置以适应企业特定的业务流程和需求。SAP CRM Customizing是实现和操作mySAP CRM解决方案的关键步骤,确保系统能够无缝对接公司的...
录像30_Internal order customizing4