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

2016-10-31 13:19:31 +08:00
 CoderKo1o

PYSearch

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

Features

Requirements

Architecture

Main

Category

效果图

支持哪些风格

热门搜索风格

搜索历史风格

如何使用 PYSearch

具体使用(详情见示例程序 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 的对象属性值即可修改

  // 设置热门搜索为彩色标签风格
  searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag;
  // 设置搜索历史为带边框标签风格
  searchViewController.searchHistoryStyle = PYSearchHistoryStyleBorderTag;
  // 设置搜索模式为内嵌
  searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;
  // 隐藏搜索建议
  searchViewController.searchSuggestionHidden = YES;

期待

Licenses

All source code is licensed under the MIT License.

2721 次点击
所在节点    分享创造
3 条回复
mzh
2016-10-31 14:05:56 +08:00
很全面…
itqls
2016-10-31 14:49:43 +08:00
mark
chenyg32
2016-11-07 15:37:16 +08:00
不错不错 赞一个。命名也不错, PY

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/316769

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX