NBLPickerView
示例
要运行示例项目,请克隆仓库,然后首先从 Example 目录中运行 pod install
要求
安装
NBLPickerView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 即可
pod 'NBLPickerView'
用法一
NSArray *optionList = @[@"北京", @"天津", @"山西", @"河北"];
NBLPickerView *pickerView = [NBLPickerView showOptionList:optionList withIndexSel:1];
pickerView.constraintPickerViewHeight.constant = 200;
pickerView.titleBackgroundColor = [UIColor whiteColor];
pickerView.separatorColor = [UIColor redColor];
pickerView.labelTitle.text = @"在这里";
__weak typeof(self) weakSelf = self;
pickerView.blockSelectOption = ^(NSInteger index) {
weakSelf.labelOption.text = optionList[index];
};
预览 Preview
用法二
NBLPickerView *pickerView = [NBLPickerView showOptionList:^NSString * _Nonnull(NSInteger row) {
return [NSString stringWithFormat:@"%@年", @(1970+row)];
} withOptionCount:50 andIndexSel:10];
pickerView.constraintPickerViewHeight.constant = 200;
pickerView.titleBackgroundColor = [UIColor whiteColor];
pickerView.separatorColor = [UIColor blueColor];
pickerView.labelTitle.text = @"在这里";
__weak typeof(self) weakSelf = self;
pickerView.blockSelectOption = ^(NSInteger index) {
weakSelf.labelOption.text = [NSString stringWithFormat:@"%@年", @(1970+index)];
};
预览 Preview
作者
杨建红, [email protected]
许可证
NBLPickerView 在MIT许可证下可用。更多信息请参阅LICENSE文件。