1

下にスクロールすると、UISearchBarがTableviewとともに移動しません。

スクロールバーを個別に配置したくありません。その要件。以下はコードです。

customSearchBar = [[UISearchBar alloc] init];
customSearchBar.delegate = self;
[customSearchBar sizeToFit];
objListTable.tableHeaderView = customSearchBar;
4

1 に答える 1

1

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 UISeachBarheight. and add UISearchBaron it.

Or else add a UIView on your code with default UISearchBar height add UISearchBar on it. It will works as you expected.

于 2013-02-05T13:28:04.410 に答える