如何在选取器 View 中隐藏分隔符。这是屏幕截图 .
这是我的自定义 UIPickerView 的代码。
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
UILabel *label=[[UILabel alloc]init];
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor whiteColor];
label.textAlignment=NSTextAlignmentCenter;
switch (component) {
case 0:
label.text=[_hourArray objectAtIndex:row];
label.font = [UIFont fontWithName:@"MYRIADPRO-REGULAR" size:70];
break;
case 1:
label.text=[_minutesArray objectAtIndex:row];
label.font = [UIFont fontWithName:@"MYRIADPRO-REGULAR" size:70];
break;
case 2:
label.text=[_ampmArray objectAtIndex:row];
label.font = [UIFont fontWithName:@"MYRIADPRO-REGULAR" size:15];
break;
default:
break;
}
return label;
}
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 3;
}
请帮帮我。谢谢
最佳答案
隐藏 UIPickerView 的选择指示器:
_pickerView.showsSelectionIndicator = FALSE;
您可以使用代码(如上所述)或 Interface Builder 来实现:
编辑
On iOS 7 and later you cannot customzie the picker view’s selection indicator. The selection indicator is always shown, so setting this property to NO has no effect.
关于iphone - UIPickerView 中的行分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20516296/