Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Row Separator in UIPickerView

How do i hide the Separator in my Picker View.Here is the screenshot enter image description here.

Here is the code for my custom 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;
}

Please Help me out.Thanks

like image 262
iYousafzai Avatar asked Dec 11 '13 10:12

iYousafzai


1 Answers

To hide the selection indicator for a UIPickerView:

_pickerView.showsSelectionIndicator = FALSE;

You can make it in code (as above) or in Interface Builder:

enter image description here

Edit

According to 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.

like image 104
Fabio Avatar answered Nov 04 '22 12:11

Fabio