Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 1.32 KB

README.md

File metadata and controls

33 lines (27 loc) · 1.32 KB

SearchTableView

UITableView subclass to easily search on tableView. Example project included.

Features

  • At first searchBar will be hidded. As user drag tableVeiw down, s/he'll see the the searchBar.
  • Orientation support

Installation

Just drag and drop SearchTableView.swift file in your project

Usage

Steps:

  1. Change UITableView class to SearchTableView in storyBoard.
  2. Make an @IBOutlet of SearchTableView in your viewController
  3. Conform to searchDataSource protocol
  4. Create model object, subclass of NSObject
  5. Assign array of model objects in itemList
  6. Return itemList.count from numberOfRowsInSection
  7. Implement searchPropertyName() of SearchTableViewDataSource protocol
  8. return model object's property name you want to search for.

Known Issue

There is an issue of searchBar overlaps statusBar. Steps to reproduce this issue:

  1. Users search
  2. Tap on any search result
  3. Navigate to another viewController
  4. Then change device orientation
  5. Back

This could be an apple bug. Apple sample code also has this issue
https://developer.apple.com/library/ios/samplecode/TableSearch_UISearchController/Introduction/Intro.html