标签:
组件_ UIToolbar
2. TextField可以以UIBarButtonItem的自定义视图的方式加入toolbar
3. 三个按钮
4. 将UIBarButtonItem加入toolBar
**/
UIToolbar *toolBar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 44)];
[self.view addSubview:toolBar];
[textField setBorderStyle:UITextBorderStyleRoundedRect];// 设置边框
[textField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];// 设置垂直对齐
[textField setClearButtonMode:UITextFieldViewModeWhileEditing];// 设置清除按钮
组件_UISearchBar
//初始化
search.frame = CGRectMake(0, 0, self.view.frame.size.width, kSearchH);
search.delegate = self;
[self.view addSubview:search];
#pragma mark 监听搜索框的文字改变
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
#pragma mark 搜索框开始编辑(开始聚焦)
组件_ UIToolbar 与 组件_UISearchBar
标签:
原文地址:http://www.cnblogs.com/linxiu-0925/p/5058177.html