iphone - UIPickerView 中的行分隔符

标签 iphone ios7 uipickerview

如何在选取器 View 中隐藏分隔符。这是屏幕截图 enter image description here .

这是我的自定义 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 来实现:

enter image description here

编辑

根据Apple documentation :

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/

相关文章:

ios - 迁移到新服务器API时处理Appstore批准的最佳实践

ios - Swift Avplayer - 当点击 'Play' 时,停止所有其他 tableviewcells 播放

iphone - iOS 7 导航栏文本和箭头颜色

iOS PhoneGap 应用提交

swift - 如何在 Swift 中为多个 UIpickerview 设置数据?

ios - 如何强制 PickerView 默认为数组项 [0]

iphone - UILocalNotification 点击​​事件

ios - 即使在可选绑定(bind)之后,可选字符也不会被删除

objective-c - 在 iOS 7 中动态调整标签大小

ios - 如何使用 UIPickerview 在两个 View Controller 之间导航