iOS 11 SearchBar in NavigationBar

后端 未结 8 1871
陌清茗
陌清茗 2020-12-12 12:44

With iOS 11 Apple has redesigned the UISearchBar by making the corners rounder and the height bigger. Adding a UISearchBar to the navigationBar is pretty simple by just sett

8条回答
  •  一向
    一向 (楼主)
    2020-12-12 13:20

    This helped me:

        if ([self.navigationItem respondsToSelector:@selector(setSearchController:)])
        {
            [self.navigationItem performSelector:@selector(setSearchController:) withObject:self.searchController];
        }
        else
        {
            self.tableView.tableHeaderView = self.searchController.searchBar;
        }
    

提交回复
热议问题