iOS CollectioniOS 控件封装别人的iOS精华

一款综合(QQ 音乐、微信、美团、优酷、虎牙直播等多款 app)

2016-10-26  本文已影响2202人  CoderKo1o

PYSearch

GitHub地址:https://github.com/iphone5solo/PYSearch
项目作者:CoderKo1o

Features

Requirements

Architecture

Main

Category

Contents

<a id="效果图"></a>效果图

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

<a id="如何使用PYSearch"></a>如何使用PYSearch

<a id="具体使用(详情见示例程序PYSearchExample)"></a>具体使用(详情见示例程序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];

<a id="自定义PYSearch"></a>自定义PYSearch

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

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

<a id="期待"></a>期待

Licenses

All source code is licensed under the MIT License.

上一篇 下一篇

猜你喜欢

热点阅读