SearchablePicker 0.1.4

SearchablePicker 0.1.4

adamhongmy 维护。



  • <adamhongmy>

Language License

SearchablePicker

带有搜索栏的简单的选择器视图。

Animation Animation

  • 类似原生行为。
  • 两种显示选项
    • 只显示标题。
    • 带描述的标题。
  • 适用于 iPhone 和 iPad。
  • 支持 iOS 9 及以上版本。
  • Objective-c

基本用法

仅标题

Objective-c

NSArray *aryCountries = [NSArray arrayWithObjects:@"Afghanistan", @"Georgia", @"Haiti", @"India", nil];

[SearchStringPickerViewController showPickerWithTitle:@"Countries"
                                                     rows:aryCountries
                                         initialSelection:[colors indexOfObject:@"India"]
                                               sourceView:sender
                                                doneBlock:^(NSInteger selectedIndex, NSString *selectedValue) {
                                                    NSLog(@"Index: %@, value: %@", selectedIndex, selectedValue);
                                                }
                                              cancelBlock:nil 
                                presentFromViewController:self];                                

带描述的标题

Objective-c

NSDictionary *dicCountries = @{@"Afghanistan" : @"Islamic Republic of Afghanistan", @"Georgia" : @"", @"Haiti" : @"Republic of Haiti", @"India" : @"Republic of India"};

[SearchStringPickerViewController showPickerWithTitle:@"Countries"
                                          rowsWithDetails:dicCountries
                                         initialSelection:self.lblPickerWithTitleAndDesc.text
                                 pickerTableViewCellStyle:UITableViewCellStyleSubtitle
                                               sourceView:sender
                                                doneBlock:^(NSString *selectedTitle, NSString *selectedDetail) {
                                                    NSLog(@"Title: %@, Detail: %@", selectedTitle, selectedDetail);
                                                }
                                              cancelBlock:nil
                                presentFromViewController:self];

有关详细示例,请下载并尝试此仓库。

安装

Cocoapod

pod 'SearchablePicker'

Carthage

即将推出!

手动操作

下载项目并将 SearchablePicker 文件夹添加到您的项目中。

动机

即将推出!

待办事项

  • 插入动机
  • 添加可定制的栏颜色
  • 在滚动条中实现字母索引
  • Cocoapod 支持
  • Carthage 支持