Cubs的专栏

今天不走,明天要跑

UISearchBar的使用

 

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;
    //searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
    //searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
   
    [self.view addSubview: searchBar];

//search Button clicked....
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar                     // called when keyboard search button pressed
{
    NSLog( @"%s,%d" , __FUNCTION__ , __LINE__ );
    [searchBar resignFirstResponder];
}
//cancel button clicked...
- (void)searchBarCancelButtonClicked:(UISearchBar *) searchBar                    // called when cancel button pressed
{
    NSLog( @"%s,%d" , __FUNCTION__ , __LINE__ );
   
    [searchBar resignFirstResponder];
   
}

转载:http://blog.csdn.net/iorchid/article/details/6542048

阅读更多
个人分类: ios
想对作者说点什么? 我来说一句

UISearchBar使用Demo

2018年06月19日 43KB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭