をキャンセルテーブルビューに、検索バーが完全にtableHeaderViewをカバーするとボタンが表示さadded.And私はレイヤーを見たことができない、まだそこに、ちょうど拡大searchbar.Anyoneでくるみボタンは?これを解決する方法を事前に感謝を知っています!検索バーのフレームは、私が検索を終了し、バックキャンセルボタンをクリックした後UIView.ThenにサブビューがTableHeaderView.ButとしてのUIViewを設定するように私は私の検索バー(左)とボタン(右)を追加ボタン
self.searchController = [[UISearchController alloc]initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WinWidth, 40)];
self.searchController.searchBar.frame = CGRectMake(0, 0, WinWidth-50, 40);
UIButton *filterBtn = [[UIButton alloc]initWithFrame:CGRectMake(WinWidth-30, 10, 20, 20)];
filterBtn setBackgroundImage:[UIImage imageNamed:@"arrow_expend_down"] forState:UIControlStateNormal];
[view addSubview:self.searchController.searchBar]; [self.searchController.searchBar addSubview:filterBtn];
self.searchController.searchBar.barTintColor = [self colorWithRGB:0xf2f2f2 alpha:1];
[view addSubview:filterBtn];
view.backgroundColor =self.searchController.searchBar.barTintColor; self.tableView.tableHeaderView = view;
シェアを試すいくつかのコード – ajjjjjjjj
コード等: 'self.searchController = [[UISearchController ALLOC] initWithSearchResultsController:なし]。 self.searchController.searchResultsUpdater = self; UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0、0、WinWidth、40)]; self.searchController.searchBar.frame = CGRectMake(0、0、WinWidth-50,40); UIButton * filterBtn = [[UIButton ALLOC] initWithFrame:CGRectMake(WinWidth-30、10、20、20)]。 '' ' – JoeyYYF
と: ' '' [filterBtn setBackgroundImage:[UIImage imageNamed: "arrow_expend_down" @] forState:UIControlStateNormal]; [表示するaddSubview:self.searchController.searchBar]; [self.searchController.searchBar addSubview:filterBtn]; self.searchController.searchBar.barTintColor = [自己colorWithRGB:0xf2f2f2アルファ:1]; [表示するaddSubview:filterBtn]; view.backgroundColor = self.searchController.searchBar.barTintColor; self.tableView.tableHeaderView = view; '' ' – JoeyYYF