BRPickerView icon indicating copy to clipboard operation
BRPickerView copied to clipboard

如何修改顶部title的背景颜色

Open RaidenLin opened this issue 5 years ago • 5 comments
trafficstars

如题,最近在适配iOS13,发现顶部的背景颜色、确定与取消不知道该如何修改

RaidenLin avatar Dec 03 '19 01:12 RaidenLin

设置背景颜色 BRPickerStyle.h 文件里都有

/** 设置 titleLabel 的背景颜色(backgroundColor)*/
@property (nonatomic, strong) UIColor *titleLabelColor;

适配深色模式可以参考如下代码:

- (BRPickerStyle *)pickerStyleWithDarkModel {
    BRPickerStyle *customStyle = [[BRPickerStyle alloc]init];
    // 适配深色模式
    if (@available(iOS 13.0, *)) {
        customStyle.maskColor = [[UIColor labelColor] colorWithAlphaComponent:0.2f];
        customStyle.shadowLineColor = [UIColor quaternaryLabelColor];
        customStyle.titleBarColor = [UIColor systemBackgroundColor];
        customStyle.cancelTextColor = [UIColor labelColor];
        customStyle.doneTextColor = [UIColor labelColor];
        customStyle.titleTextColor = [UIColor placeholderTextColor];
        customStyle.titleLineColor = [UIColor quaternaryLabelColor];
        
        customStyle.pickerColor = [UIColor systemBackgroundColor];
        customStyle.pickerTextColor = [UIColor labelColor];
        customStyle.separatorColor = [UIColor separatorColor];
    }
    
    return customStyle;
}

agiapp avatar Dec 03 '19 01:12 agiapp

最顶部还是有一条白线

RaidenLin avatar Dec 03 '19 01:12 RaidenLin

标题栏顶部和底部都有边框线(即分割线),可以隐藏的

/** 隐藏 alertView 弹框视图顶部边框线,默认为 NO */
@property (nonatomic, assign) BOOL hiddenShadowLine;

/** 隐藏 titleBarView 标题栏底部边框(border-bottom),默认为 NO  */
@property (nonatomic, assign) BOOL hiddenTitleBottomBorder;

agiapp avatar Dec 03 '19 01:12 agiapp

也可以修改顶部分割线的颜色

/** 设置 alertView 弹框视图顶部边框线颜色  */
@property (nonatomic, strong) UIColor *shadowLineColor;

agiapp avatar Dec 03 '19 01:12 agiapp

问题已解决,感谢大佬

RaidenLin avatar Dec 03 '19 01:12 RaidenLin