如何在“选择器” 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中创建它:

编辑

根据Apple documentation:

关于iphone - UIPickerView中的行分隔符,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20516296/

10-14 22:26