PGPickerView是將UIPickerView的彎曲弧度變成直列表掖鱼,可以是單列表荚醒,多列表蝴乔,還可以修改選中l(wèi)abel的字體顏色等长酗。
PGPickerView.gif
GitHub Address
https://github.com/xiaozhuxiong121/PGPickerView
Installation with CocoaPods
pod 'PGPickerView'
Usage
PGPickerView *pickerView = [[PGPickerView alloc]initWithFrame:self.view.bounds];
pickerView.delegate = self;
pickerView.dataSource = self;
[self.view addSubview:pickerView];
#pragma PGPickerViewDataSource
- (NSInteger)numberOfComponentsInPickerView:(PGPickerView *)pickerView {
return 2;
}
- (NSInteger)pickerView:(PGPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return 10;
}
#pragma PGPickerViewDelegate
- (nullable NSString *)pickerView:(PGPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
return [NSString stringWithFormat:@"label%ld--%ld", component, row];
}