UISearchBar
2015-12-23 10:23
471 查看
//修改UISearchBar取消按钮颜色 [[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:[NSArray arrayWithObjects:[UISearchBar class], nil]] setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor greenColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateNormal]; UISearchBar * searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 6.0f, UI_SCREEN_WIDTH ,64.0f )]; searchBar.delegate = self; searchBar.barStyle = UIBarStyleBlackTranslucent; searchBar.backgroundColor = [UIColor clearColor]; searchBar.autocorrectionType = UITextAutocorrectionTypeNo; searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone; searchBar.showsCancelButton = YES; searchBar.placeholder = @"搜索"; // searchBar.tintColor = [UIColor clearColor];//COLOR_HEX(0x9A8316) searchBar.keyboardType = UIKeyboardTypeDefault; searchBar.returnKeyType = UIReturnKeySearch; [searchBar setSearchFieldBackgroundImage:[IMG(@"input_discovery_search.png") resizableImageWithCapInsets:UIEdgeInsetsMake(10.0f, 20.0f, 10.0f, 20.0f) resizingMode:UIImageResizingModeStretch] forState:UIControlStateNormal]; [searchBar setImage:IMG(@"icon_discovery_search.png") forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal]; [searchBar setImage:IMG(@"icon_search_cancle.png") forSearchBarIcon:UISearchBarIconClear state:UIControlStateNormal];
相关文章推荐
- 代码优化之UI布局
- Overdue resource check-out stack trace
- 详解 CALayer 和 UIView 的区别和联系
- iOS UISearchController 的简单使用
- UIAlertView is deprecated in ios9
- iOS常用控件-UIScrollView
- UITableview 左滑编辑
- 【代码笔记】带输入框的UIAlertView
- 【代码笔记】带输入框的UIAlertView
- 自定义UIPickerView
- IOS UILabel 、帧动画
- UITextField 输入框的基本使用(创建显示,回收键盘)
- 5-7 UVA 12100 Printer Queue打印队列
- uinx环境高级高级编程---------孤儿进程与僵尸进程
- Scrum Guide - Scrum指南中文版
- POJ 1019 Number Sequence
- Unique Paths II
- [LeetCode] 11. Container With Most Water My Submissions Question 解题思路
- uiviewcontroller 转场放大缩小动画
- debian 6.0 squeeze 上的 xen 网桥问题