Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS14 适配 #11

Open
HeDefine opened this issue Sep 27, 2020 · 1 comment
Open

iOS14 适配 #11

HeDefine opened this issue Sep 27, 2020 · 1 comment

Comments

@HeDefine
Copy link

iOS14中,设置隐藏分割线的时候,数组越界。因为iOS14 的UIPickerView的子视图层次改变了。

if (_hideSegmentedLine) {
        ((UIView *)[self.datePicker.subviews objectAtIndex:1]).backgroundColor = [UIColor clearColor];
        ((UIView *)[self.datePicker.subviews objectAtIndex:2]).backgroundColor = [UIColor clearColor];
    }

iOS14 的数据选择器不再有分割线了。它现在 从一个选中行的两条分割线 改成了一个圆角的遮罩视图。
为了兼容老版本建议改成

if(_hideSegmentedLine) {
    for (UIView *view in self.datePicker.subviews) {
        if (view.frame.size.height <= 1) {
            view.backgroundColor = UIColor.clearColor;
        }
    }
}
@CXTretar
Copy link
Owner

@HeDefine 谢谢提醒,按照你的解决方案修改了!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants