美文网首页征服iOS
去掉UIPickerView的弯曲弧度

去掉UIPickerView的弯曲弧度

作者: piggybear | 来源:发表于2017-07-31 16:05 被阅读499次

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

    相关文章

      网友评论

        本文标题:去掉UIPickerView的弯曲弧度

        本文链接:https://www.haomeiwen.com/subject/hyhrlxtx.html