BRPickerView icon indicating copy to clipboard operation
BRPickerView copied to clipboard

间距异常

Open CH305426 opened this issue 2 years ago • 1 comments

你好, 我使用的是时间选择器

BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init];
datePickerView.pickerMode = BRDatePickerModeHM;
datePickerView.title = @"设置时间提醒";
datePickerView.selectDate = ({
    NSString *text = self.timeLab.text;
    NSArray *array = [text componentsSeparatedByString:@":"];
    NSDate *sss = [NSDate br_setHour:[array[0] integerValue]  minute:[array[1] integerValue]];
    sss;
});
datePickerView.isAutoSelect = NO;
datePickerView.showUnitType = BRShowUnitTypeOnlyCenter;
datePickerView.pickerStyle = ({
    //自定义样式
    BRPickerStyle *style = [[BRPickerStyle alloc] init];
    style.pickerColor = BR_RGB_HEX(0xFFFFFF, 1.0f);
    style.separatorColor = [UIColor clearColor];
    style.topCornerRadius = 12;
    
    /** 设置 titleBarView*/
    style.hiddenTitleLine = NO;
    style.titleLineColor = UIColorHex(#F6F6F8);
    style.titleBarHeight = 60;
    
    /** 设置 titleLabel */
    style.titleTextColor = UIColorHex(#333333);
    style.titleTextFont = [UIFont systemFontOfSize:17 weight:UIFontWeightMedium];
    style.titleLabelFrame = CGRectMake(100, 0, kScreenWidth- 200, 60);
    
    /** 设置 doneBtn */
    style.doneTextColor = UIColorHex(#51B7DC);
    style.doneTextFont = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
    style.doneBtnFrame = CGRectMake(kScreenWidth- 80, 0, 80, 60);
    
    /** 设置 cancelBtn */
    style.cancelTextColor = UIColorHex(#666666);
    style.cancelTextFont = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
    style.cancelBtnFrame = CGRectMake(0, 0, 80, 60);
    
    style.paddingBottom = kSafeArea_Bottom;
    style.rowHeight = 60;
    style.pickerHeight = 286;
    
    style.selectRowColor = UIColorHex(#F8F9FC);

    style.pickerTextColor = UIColorHex(#4C5362);
    style.pickerTextFont = [UIFont fontWithName:DIN_ALTERNATE size:22];
    
    style.dateUnitTextFont = [UIFont systemFontOfSize:14];
    style.dateUnitTextColor = UIColorHex(#4C5362);
    
    style;
});

datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) {
    NSLog(@"选择的值:%@", selectValue);
};
[datePickerView show];

碰到的问题是 ,在年月日上 pickerView看着挺好的, 但是在时分上有间距, 不知道为啥了

lQDPJxZpYoESYSfNBQDNAlCwb7tjsQnGsdcCrbqOO0AHAA_592_1280 jpg_720x720g

lQDPJxZpYoGq-SrNBQDNAlCwFGfT4gnLN3MCrbqPp8AHAA_592_1280 jpg_720x720g

CH305426 avatar Jun 17 '22 07:06 CH305426

是iOS哪个系统,我这边在模拟器上(iOS14、iOS15)测试没有问题。使用的样例代码,效果如下: image

另外显示效果有异常,也可以使用下面这两个属性,对单位Label的位置进行微调

/** 设置日期选择器单位 label 的水平方向偏移量 */
@property (nonatomic, assign) CGFloat dateUnitOffsetX;

/** 设置日期选择器单位 label 的竖直方向偏移量 */
@property (nonatomic, assign) CGFloat dateUnitOffsetY;

agiapp avatar Jun 17 '22 07:06 agiapp