首页 > 代码库 > swift随笔

swift随笔

<style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa } span.s1 { } span.s2 { color: #ba2da2 } span.s3 { color: #703daa } span.s4 { color: #000000 }</style>

1.导航栏添加搜索框:

  let sc=UISearchController(searchResultsController: nil)

  sc.searchResultsUpdater = self

  self.navigationItem.titleView=sc.searchBar

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

 

<style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa } span.s1 { } span.s2 { color: #ba2da2 } span.s3 { color: #703daa } span.s4 { color: #000000 }</style>

 let sc=UISearchController(searchResultsController: nil)

  sc.searchResultsUpdater = self

  tableview.tableHeaderView=sc.searchBar

swift随笔