Created
July 5, 2014 14:36
-
-
Save mwise/bab66be2682c1c9792f9 to your computer and use it in GitHub Desktop.
Revisions
-
mwise created this gist
Jul 5, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ module RMExtensions module SearchableTable def setup_search_controller(opts) $self = self @search_bar = UISearchBar.alloc.initWithFrame( CGRectMake(0, 0, frame.size.width, 44)) @search_controller = UISearchDisplayController.alloc .initWithSearchBar(@search_bar, contentsController: rmq.view_controller) @search_controller.delegate = self @search_controller.searchResultsDataSource = self @search_controller.searchResultsDelegate = self @search_controller.displaysSearchBarInNavigationBar = true @search_opts = opts end def searchDisplayController(controller, shouldReloadTableForSearchString: search_string) if @search_opts[:action] && @search_opts[:action].respond_to?(:call) @search_opts[:action].call(search_string) end !@search_opts[:async] false end end end