swift随笔

1.导航栏添加搜索框:

  let sc=UISearchController(searchResultsController: nil)

  sc.searchResultsUpdater = self

  self.navigationItem.titleView=sc.searchBar

2.导航栏下面添加搜索框:

 

 let sc=UISearchController(searchResultsController: nil)//放函数外面才有用

  sc.searchResultsUpdater = self

  tableview.tableHeaderView=sc.searchBar

原文地址:https://www.cnblogs.com/auvxx/p/6694388.html