Open HeDefine opened 4 years ago
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; } } }
@HeDefine 谢谢提醒,按照你的解决方案修改了!
iOS14中,设置隐藏分割线的时候,数组越界。因为iOS14 的UIPickerView的子视图层次改变了。
iOS14 的数据选择器不再有分割线了。它现在 从一个选中行的两条分割线 改成了一个圆角的遮罩视图。 为了兼容老版本建议改成