• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    Objective-C
  • Created over 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

高仿微信搜索框,自定义SearchController

JKRCustomSearchController

preview 

preview 

模仿微信自定义searchController

和UISearchController相同的使用方式,只需要设置searchBar为tableView的tableHeaderView就可以:

[self.tableView setTableHeaderView:self.searchController.searchBar];

控制器懒加载:

- (JKRSearchController *)searchController {
    if (!_searchController) {
        JKRSearchResultViewController *resultSearchController = [[JKRSearchResultViewController alloc] init];
        _searchController = [[JKRSearchController alloc] initWithSearchResultsController:resultSearchController];
        _searchController.searchBar.placeholder = @"搜索";
        _searchController.hidesNavigationBarDuringPresentation = YES;
        _searchController.searchResultsUpdater = self;
        _searchController.searchBar.delegate = self;
        _searchController.delegate = self;
    }
    return _searchController;
}

搜索结果展示:

#pragma mark - JKRSearchControllerhResultsUpdating
- (void)updateSearchResultsForSearchController:(JKRSearchController *)searchController {
    NSString *searchText = searchController.searchBar.text;
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SELF CONTAINS %@)", searchText];
    JKRSearchResultViewController *resultController = (JKRSearchResultViewController *)searchController.searchResultsController;
    if (!(searchText.length > 0)) resultController.filterDataArray = @[];
    else resultController.filterDataArray = [self.dataArray filteredArrayUsingPredicate:predicate];
}

More Repositories

1

JKRComplexFallsDemo

放大瀑布流
Objective-C
67
star
2

JKRCategory

自定义分类,拆分常用的功能
Objective-C
50
star
3

JKRAVCamera

自定义相机Demo,实现相机操控,手持方向监听,视频合并,滤镜
C++
49
star
4

iOS10-Bug-Demo

让iOS10无限黑屏重启
Objective-C
32
star
5

JKRBubblePresent

模仿百度外卖首页搜索界面弹出效果
Objective-C
22
star
6

flutter-geetest

极验行为验证flutter版
Java
15
star
7

JKRShimmeringLabel

炫彩闪动、流动闪动、超出范围自动滚动、炫酷昵称、彩色流动文本
Objective-C
14
star
8

Objective_C_Data_Structure

利用Objective-C自定义实现各种数据结构
Objective-C++
10
star
9

JKRStorePage

模仿京东商品详情页布局
Objective-C
6
star
10

MessageImageCategory

Message tip icon. 消息提示图标
Objective-C
6
star
11

JKRAddressSelector

高仿美团地址选择器
Objective-C
6
star
12

JKRRecordTool

Recordtool, wav to amr and data to base64String. 录音工具类,wav转amr,NSData转Base64String
Objective-C
4
star
13

SpriteKit-Chinese-Documentation

SpriteKit中文文档
4
star
14

iOS-ProgressBar-Circle

一个用于iOS的圆形进度条,带有文字显示进度。可以定义文字大小颜色,圆形进度条宽度颜色。
Objective-C
2
star
15

UISearchControllerDemo

UISearchController使用Demo
Objective-C
2
star
16

SimpleWord-Edit

SimpleWord根据自身需要修改,添加了向服务器上传的功能
Objective-C
2
star
17

JKRTimePicker

JKRTimePicker,可以多选的时间选择器
Objective-C
2
star
18

JKRKVODemo

KVO封装Demo
Objective-C
1
star
19

Swift-FuntionalProgramming

Swift
1
star
20

Swift-Prefix

Swift
1
star
21

DataStructureDemo

自定义各种数据结构实现和应用
JavaScript
1
star