一款综合( QQ 音乐、微信、美团、优酷、虎牙直播等多款 app)风格的搜索控制器 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
CoderKo1o
V2EX    分享创造

一款综合( QQ 音乐、微信、美团、优酷、虎牙直播等多款 app)风格的搜索控制器

  •  
  • /li>
  •   CoderKo1o
    iphone5solo 2016-10-31 13:19:31 +08:00 3202 次点击
    这是一个创建于 3273 天前的主题,其中的信息可能已经有所发展或是发生改变。

    PYSearch

    GitHub 地址:https://github.com/iphone5solo/PYSearch

    • 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

    效果图

    (img)

    支持哪些风格

    热门搜索风格

    (img) (img) (img) (img) (img) (img)

    搜索历史风格

    (img) (img) (img) (img) (img)

    如何使用 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.searchResultController.title = @"PYSearchResultController"; }]; // 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 !我会根据大家的需求提供更多的接口!

    Licenses

    All source code is licensed under the MIT License.

    3 条回复    2016-11-07 15:37:16 +08:00
    mzh
        1
    mzh  
       2016-10-31 14:05:56 +08:00 via iPhone
    很全面…
    itqls
        2
    itqls  
       2016-10-31 14:49:43 +08:00
    mark
    chenyg32
        3
    chenyg32  
       2016-11-07 15:37:16 +08:00
    不错不错 赞一个。命名也不错, PY
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5543 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 28ms UTC 07:28 PVG 15:28 LAX 00:28 JFK 03:28
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86