1 Star 0 Fork 10

fnet / PYSearch

forked from CoderKo1o / PYSearch 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

PYSearch

Build Status Pod Version Pod Platform Pod License

  • 🔍 An elegant search controller for iOS.
  • 🔍 iOS 中一款优雅的搜索控制器。

Features

  • 支持多种热门搜索风格
  • 支持多种搜索历史风格
  • 支持多种搜索结果显示模式
  • 支持搜索建议
  • 支持搜索历史(记录)缓存
  • 支持使用delegate 或者 block 完成搜索时的回调
  • 支持CocoaPods

Requirements

  • iOS 7.0 or later
  • Xcode 7.0 or later

Architecture

Main

  • PYSearch
  • PYSearchConst
  • PYSearchViewController
  • PYSearchSuggestionViewController

Category

  • UIColor+PYExtension
  • UIView+PYExtension

Contents

效果图

支持哪些风格

热门搜索风格



搜索历史风格



如何使用PYSearch

  • 使用CocoaPods:
    • pod "PYSearch"
    • 导入主头文件#import <PYSearch.h>
  • 手动导入:
    • PYSearch文件夹中的所有文件拽入项目中
    • 导入主头文件#import "PYSearch.h"

具体使用(详情见示例程序PYSearchExample)

    // 1. 创建热门搜索数组
    NSArray *hotSeaches = @[@"Java", @"Python", @"Objective-C", @"Swift", @"C", @"C++", @"PHP", @"C#", @"Perl", @"Go", @"JavaScript", @"R", @"Ruby", @"MATLAB"];
    // 2. 创建搜索控制器
    PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:hotSeaches searchBarPlaceholder:@"搜索编程语言" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
        // 开始(点击)搜索时执行以下代码
        // 如:跳转到指定控制器
        [searchViewController.navigationController pushViewController:[[UIViewController alloc] init] animated:YES];
        
    }];
    // 3. 跳转到搜索控制器
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController];
    [self presentViewController:nav  animated:NO completion:nil];

自定义PYSearch

通过设置searchViewContoller的对象属性值即可修改

  • 设置热门搜索风格(默认为PYHotSearchStyleNormalTag)
	// 设置热门搜索为彩色标签风格
	searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag;
  • 设置搜索历史风格(默认为PYSearchHistoryStyleCell)
	// 设置搜索历史为带边框标签风格
	searchViewController.searchHistoryStyle = PYSearchHistoryStyleBorderTag;
  • 设置搜索结果显示模式(默认为PYSearchResultShowModePush)
	// 设置搜索模式为内嵌
	searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;
  • 隐藏搜索建议(默认为:NO)
	// 隐藏搜索建议
	searchViewController.searchSuggestionHidden = YES;

期待

  • 如果您在使用过程中有任何问题,欢迎issue me! 很乐意为您解答任何相关问题!
  • 与其给我点star,不如向我狠狠地抛来一个BUG!
  • 如果想要参与这个项目的维护或者有好的设计风格,欢迎pull request!
  • 如果您想要更多的接口来自定义或者建议/意见,欢迎issue me!我会根据大家的需求提供更多的接口!
  • 如果您在使用中觉得略有不适,欢迎联系我QQ:499491531,希望一起完善此项目,让它变成更强大,能够满足大多数用户的需求!

Licenses

All source code is licensed under the MIT License.

The MIT License (MIT) Copyright (c) 2016 CoderKo1o Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

iOS 中一款优雅的搜索控制器。 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/fnet/PYSearch.git
git@gitee.com:fnet/PYSearch.git
fnet
PYSearch
PYSearch
master

搜索帮助