由于 系统的DatePicker界面不符合要求,所以进行一些修改:
//datePicker 中间显示的 上线线条 ,改为蓝色
UIView *datePickerViewLine = [[self.datePickerView subviews] objectAtIndex:0];
UIView * topLine = [[datePickerViewLine subviews] objectAtIndex:1];
[topLine setBackgroundColor: [UIColor blueColor]];
UIView * bottomLine = [[datePickerViewLine subviews] objectAtIndex:2];
[bottomLine setBackgroundColor:[UIColor blueColor]];
// datePicker 选中行 字体颜色 改为蓝色
[self.datePickerView setValue:[UIColor blueColor] forKey:@"textColor"];
一切都OK, 在6s手机、9.3.2系统下 正常,达到理想效果
But 在4s手机、8.1系统下就崩溃了,报错
pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug
一开始以为 是哪个值 提前释放了,研究了半天,实在 找不到原因, 只能才去最笨的办法, 一个控件一个控件的注视掉,看看哪个出现问题。
最终,我把上面代码注视掉 就OK了。