nitz19arg
nitz19arg

Reputation: 427

how to append Search bar in custom table view programatically

I have implemented the table view using custom table view cell. I want to put the search bar in table view.

Can someone tell me how i can programmatically append one such search bar. please try not to provide external links. thanks.

Upvotes: 0

Views: 460

Answers (1)

Dilip Manek
Dilip Manek

Reputation: 9143

UISearchBar *tempSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 0)];
self.searchBar = tempSearchBar;
[tempSearchBar release];
self.searchBar.delegate = self; 
[self.searchBar sizeToFit];  
self.tableView.tableHeaderView = self.searchBar; 

hope this help.

Upvotes: 1

Related Questions