Skip to content
šŸ” An elegant search controller which replaces the UISearchController for iOS (iPhone & iPad) .
Branch: master
Clone or download
sunleic and ko1o Fixed the bug in iOS11 that entered the page in modal mode, and a lefā€¦
ā€¦t-to-right flashing of the search bar caused by the constraint error.(#210)

Fixed the bug in iOS11 that entered the page in modal mode, and a left-to-right flashing of the search bar caused by the constraint error.(#210)
Latest commit a565349 Mar 3, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
PYSearch Fixed the bug in iOS11 that entered the page in modal mode, and a lefā€¦ Mar 3, 2019
PYSearchExample Added showKeyboardWhenReturnSearchResult property (#170) Jun 8, 2018
.gitignore
.travis.yml Modify .travis.yml Oct 28, 2016
LICENCE
PYSearch.podspec Bumped version to 0.9.1 Oct 28, 2018
README.md Update README.md May 30, 2018

README.md



Apps Using Total Downloads
Build Status Pod Version Pod Platform Pod License

  • šŸ” An elegant search controller for iOS.

QQ chat room

Ā 

Features

  • Support a variety of hot search style
  • Support a variety of search history style
  • Support a variety of search results display mode
  • Support a variety of search view controller display mode
  • Support search suggestions
  • Support search history (record) cache
  • Support callback using delegate or block completion search
  • Support CocoaPods
  • Support localization
  • Support vertical and horizontal screen on iPhone and iPad

Requirements

  • iOS 7.0 or later
  • Xcode 7.0 or later

Architecture

Main

  • PYSearch
  • PYSearchConst
  • PYSearchViewController
  • PYSearchSuggestionViewController

Category

  • UIColor+PYSearchExtension
  • UIView+PYSearchExtension
  • NSBundle+PYSearchExtension

Contents

Renderings

Styles

Hot search style



Search history style



How to use

  • Use CocoaPods:
    • pod "PYSearch"
    • Import the main fileļ¼š#import <PYSearch.h>
  • Manual importļ¼š
    • Drag All files in the PYSearch folder to project
    • Import the main fileļ¼š#import "PYSearch.h"

Details (See the example program PYSearchExample for details)

    // 1. Create hotSearches array
    NSArray *hotSeaches = @[@"Java", @"Python", @"Objective-C", @"Swift", @"C", @"C++", @"PHP", @"C#", @"Perl", @"Go", @"JavaScript", @"R", @"Ruby", @"MATLAB"];
    // 2. Create searchViewController
    PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:hotSeaches searchBarPlaceholder:@"Search programming language" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
        // Call this Block when completion search automatically
        // Such as: Push to a view controller
        [searchViewController.navigationController pushViewController:[[UIViewController alloc] init] animated:YES];
        
    }];
    // 3. present the searchViewController
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController];
    [self presentViewController:nav  animated:NO completion:nil];

Custom

  • Custom search suggestions display
// 1. Set dataSource
searchViewController.dataSource = self;
// 2. Implement dataSource method
  • Custom search result dispaly
// 1. Set searchResultShowMode
searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;
// 2. Set searchResultController 
searchViewController.searchResultController = [[UIViewController alloc] init];
  • Set hotSearchStyleļ¼ˆdefault is PYHotSearchStyleNormalTagļ¼‰
// Set hotSearchStyle
searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag;
  • Set searchHistoryStyleļ¼ˆdefault is PYSearchHistoryStyleCellļ¼‰
// Set searchHistoryStyle
searchViewController.searchHistoryStyle = PYSearchHistoryStyleBorderTag;
  • Set searchHistoriesCachePathļ¼ˆdefault is PYSEARCH_SEARCH_HISTORY_CACHE_PATHļ¼‰
// Set searchHistoriesCachePath
searchViewController.searchHistoriesCachePath = @"The cache path";
  • Set searchHistoriesCountļ¼ˆdefault is 20ļ¼‰
// Set searchHistoriesCount
searchViewController. searchHistoriesCount = 6;
  • Set searchResultShowModeļ¼ˆdefault is PYSearchResultShowModeCustomļ¼‰
// Set searchResultShowMode
searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;
  • Set searchSuggestionHiddenļ¼ˆdeafult is NOļ¼‰
// Set searchSuggestionHidden
searchViewController.searchSuggestionHidden = YES;

Hope

  • If you have any questions during the process or want more interfaces to customizeļ¼Œyou can issues me!
  • Instead of giving me star, it is better to throw a bug to me!
  • If you want to participate in the maintenance of this project or have a good design style, welcome to pull request!
  • If you feel slightly discomfort in use, please contact me QQ:499491531 or Email:499491531@qq.com.
  • Hope to improve this project together, let it become more powerful, able to meet the needs of most users!

Licenses

All source code is licensed under the MIT License.

You canā€™t perform that action at this time.