Reputation: 427
UISearchBar is not moving with Tableview when scrolling down.
I don't want to separately place the scrollbar. Its a requirement. Below is the code.
customSearchBar = [[UISearchBar alloc] init];
customSearchBar.delegate = self;
[customSearchBar sizeToFit];
objListTable.tableHeaderView = customSearchBar;
Upvotes: 1
Views: 444
Reputation: 1542
Need to include a View and add UISearchbar on it, or else provide height of the Header view. By default its treats as 0.0.
If you want to use
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
the method allocate a View with height of default UISeachBar
height. and add UISearchBar
on it.
Or else add a UIView
on your code with default UISearchBar
height add UISearchBar
on it. It will works as you expected.
Upvotes: 1