- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(nullable UIView *)view;
{
UILabel* pickerLabel = (UILabel*)view;
if (!pickerLabel){
pickerLabel = [[UILabel alloc] init];
pickerLabel.font=[UIFont systemFontOfSize: weight:];
pickerLabel.textColor=[UIColor whiteColor];
pickerLabel.textAlignment=;
[pickerLabel setBackgroundColor:[UIColor clearColor]];
}
pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component];
//在该代理方法里添加以下两行代码删掉上下的黑线
[[pickerView.subviews objectAtIndex:] setHidden:TRUE];
[[pickerView.subviews objectAtIndex:] setHidden:TRUE];
return pickerLabel;
}
05-04 03:32