gpt4 book ai didi

iphone - UIPickerView 中的行分隔符

转载 作者:行者123 更新时间:2023-12-03 18:45:45 25 4
gpt4 key购买 nike

如何在选取器 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com