Coder Social home page Coder Social logo

hzrzcw / pysearch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ko1o/pysearch

0.0 2.0 0.0 530 KB

🔍 An elegant search controller which replaces the UISearchController for iOS (iPhone & iPad) .

License: MIT License

Ruby 0.61% Objective-C 99.39%

pysearch's Introduction

PYSearch

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 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:[email protected].
  • 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.

pysearch's People

Contributors

ko1o avatar codejcson avatar sam-spencer avatar lzzhoujielun avatar zhongdom avatar

Watchers

James Cloos avatar Nanmenhaishao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.