- searchBar = [[UISearchBar alloc] initWithFrame: CGRectMake(0.0, 0.0, self.view.bounds.size.width, 40)];
- searchBar.placeholder=@"Enter Name";
- searchBar.delegate = self;
- searchBar.showsCancelButton = YES;
- theTableView.tableHeaderView = searchBar;
- searchBar.keyboardType = UIKeyboardTypeDefault;
-
-
-
- [self.view addSubview: searchBar];
-
- - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
- {
- NSLog( @"%s,%d" , __FUNCTION__ , __LINE__ );
- [searchBar resignFirstResponder];
- }
- - (void)searchBarCancelButtonClicked:(UISearchBar *) searchBar
- {
- NSLog( @"%s,%d" , __FUNCTION__ , __LINE__ );
-
- [searchBar resignFirstResponder];
-
- }
UISearchBar的使用,布布扣,bubuko.com
UISearchBar的使用
原文:http://www.cnblogs.com/yulang314/p/3790439.html