Giter VIP home page Giter VIP logo

Comments (1)

agiapp avatar agiapp commented on June 24, 2024

参考代码如下

/// 多列字符串
BRStringPickerView *stringPickerView = [[BRStringPickerView alloc]init];
stringPickerView.pickerMode = BRStringPickerComponentMulti;
stringPickerView.dataSourceArr = @[@[@"01", @"02", @"03", @"04", @"05", @"06", @"07", @"08", @"09", @"10", @"11", @"12"], @[@"00", @"10", @"20", @"30", @"40", @"50"]];
stringPickerView.isAutoSelect = YES;
stringPickerView.resultModelArrayBlock = ^(NSArray<BRResultModel *> *resultModelArr) {
    textField.text = [NSString stringWithFormat:@"%@:%@", resultModelArr[0].value, resultModelArr[1].value];
};

// 设置自定义样式
BRPickerStyle *customStyle = [[BRPickerStyle alloc]init];
// 设置 picker 的列宽
customStyle.columnWidth = 30;
// 设置 picker 的列间隔
customStyle.columnSpacing = 60;
// 设置圆角矩形背景
// 方式1:使用系统自带样式,保留iOS14之后系统默认的圆角样式
customStyle.clearPickerNewStyle = NO;
// 方式2:可以使用UIView自定义一个圆角矩形视图rectView,并添加到 alertView 上也能实现同样的效果([stringPickerView.alertView addSubview:rectView];)
// 设置选择器中间选中行的样式
customStyle.selectRowTextFont = [UIFont boldSystemFontOfSize:20.0f];
customStyle.selectRowTextColor = [UIColor blueColor];
stringPickerView.pickerStyle = customStyle;

[stringPickerView show];

显示效果

image

from brpickerview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.