去掉UIPickerView的彎曲弧度

小豬熊發表於2017-12-13

PGPickerView是將UIPickerView的彎曲弧度變成直列表,可以是單列表,多列表,還可以修改選中label的字型顏色等。

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];
}

複製程式碼

相關文章