Code Monkey home page Code Monkey logo

91renb / brpickerview Goto Github PK

View Code? Open in Web Editor NEW
2.5K 32.0 436.0 10.16 MB

BRPickerView 封装的是iOS中常用的选择器组件,主要包括:日期选择器(支持年月日、年月等15种日期样式选择,支持设置星期、至今等)、地址选择器(支持省市区、省市、省三种地区选择)、自定义字符串选择器(支持单列、多列、二级联动、三级联动选择)。支持自定义主题样式,适配深色模式,支持将选择器组件添加到指定容器视图。

Home Page: https://github.com/agiapp/BRPickerView

License: MIT License

Objective-C 98.97% Ruby 0.64% Swift 0.38%
pickerview uipickerview uidatepicker datepicker picker date time countdowntimer region

brpickerview's Issues

window的使用

建议使用[[UIApplication sharedApplication].delegate window] 来代替[[UIApplication sharedApplication] keyWindow]

横竖屏及ipad显示

能否源码中配置下view的autoresizingMask ,已适配下横竖屏及ipad, 我修改了下,感觉还可以,希望框架适应性更好一些.

神秘 ISSUE

looking for a NEW PERFECT JOB ?

address: 浙江省 杭州市 萧山区 中栋国际
email: [email protected]
phone: 1100001100001000100111101101100000

希望添加时间选择多样化

UIDatePickerModeTime,
UIDatePickerModeDate,
UIDatePickerModeDateAndTime,
UIDatePickerModeCountDownTimer,

只有这四种模式,有时不符合业务逻辑。比如只要年和月 年的

每个月的天数是不同的,不能定死31天,虽然不能选择,但是用户体验不太好

设置时间的上下限直接崩溃

[BRDatePickerView showDatePickerWithTitle:@"请选择开始时间" dateType:UIDatePickerModeDateAndTime defaultSelValue:@"2018-03-27 00:00:00" minDateStr:@"2018-03-21 15:00:00" maxDateStr:@"2018-04-05 16:00:00" isAutoSelect:NO themeColor:nil resultBlock:^(NSString *selectValue) {
MYLog(@"------%@",selectValue);
}];

获取去角标代码

typedef void(^BRStringResultBlock)(id selectValue,NSInteger selectRow);
@Property (nonatomic,assign) NSInteger selectRow;

  • (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    switch (self.type) {
    case BRStringPickerComponentSingle:
    {
    self.selectValue = self.dataSourceArr[row];
    self.selectRow = row;

          // 设置是否自动回调
          if (self.isAutoSelect) {
              if(self.resultBlock) {
                  self.resultBlock(self.selectValue,self.selectRow);
              }
          }
      }
    

关于类型为`NSTaggedPointerString`类型造成数据源不合法

很感谢楼主分享的选择器,很好用。

但最近用到的时候出现了一个比较尴尬的问题,就是数据解析后NSString有时的类型是NSTaggedPointerString(位于17索引),数据源如下:

// 位于BRStringPickerView.m 126行

Class itemClass = [[dataArr firstObject] class];//__NSCFString

for (id obj in dataArr) {

    //obj = "VR"(NSTaggedPointerString),同样作为NSString的子类,但是是不会通过验证的
    if (![obj isKindOfClass:itemClass]) {
        isDataSourceValid = NO;
        break;
    }
}

😀😀

功能建议

希望 标题 左右两边的按钮设置 能在外面单独设置,单独传一个自定义颜色有时候可能不满足项目需求

地址选择器确认选择后,能新增返回省市区对应的ID吗?

1.地址选择器确认选择后,能新增返回省市区对应的ID?虽然现在也可以遍历拿到,感觉还是在选择的时候就返回更好。
typedef void(^BRAddressResultBlock)(NSArray *selectAddressArr, NSArray *selectIdArray)

2.在BRAddressPickerView.m文件中
// 根据 省索引和城市索引 获取 区域名数组

  • (NSArray *)getAreaNameArray:(NSInteger)provinceIndex cityIndex:(NSInteger)cityIndex

这个方法能否直接根据cityIndex,去取模型中对应的属性,而不要去遍历?其他类似方法也一样处理下
十分感谢

pod install 后,BRCIty.plist丢失

${PODS_ROOT}/BRPickerView/BRPickerView/AddressPickerView/BRCity.plist
公司换了电脑,git clone后,pod install发现少了上面的文件。版本2.2.0

希望您能对数据源做些改变

从网络请求回来的数据都是类型数组,并非只含单一对象。例如是一个Address类型的array,Address里面又包含id、name、city等等。但我只想显示name, 这时用控件的数据源填写就需要把array中的name遍历单独放在一个数组里,过程相对就比较繁琐。希望您能单独封装一个专门把类型数组作为数据源,并且回调的时候最好能把选中的序号也返回回来。

手动导入工程报错

因为要使用YYKit 所以手动导入工程 报错原因是:ld: library not found for -lBRPickerView

有办法解决么

pod 'BRPickerView'

pod 'BRPickerView'
下载成功之后,在项目文件中
导入:#import <BRPickerView.h>
编译的时候 这四个文件
BRBaseView.h 报错:(Expected identifier)
BRDatePickerView.h 报错:(Expected ';' after method prototype)
BRAddressPickerView.h 报错:(Expected ';' after method prototype)
BRStringPickerView.h 报错:(Expected ';' after method prototype)
就报错。报错信息为每个文件后面的内容。

建议加上农历

NSCalendar *calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierChinese];
_datePicker.calendar = calendar;

传值给后台,有问题

你好,,例如,地址:给后台传值的时候...不可能传字符串吧...我们怎么通过你这个控件...给后台传地址的编码呢??

为什么多点几次时间选择,memory在持续增大呀

我每次点击显示pickview自定义的日历的时候,内存都扩大一点,是正常的吗?我查了下主窗口的subviews,发现个数也对,show的时候是2,下次在show之前又是1。按理说正常的,为什么来回多点几次,发现memory在持续变大呀

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.