I am using UIPicker in one of my project.
I have UIPickerView of size & position as
58, 264, 204, 216
x y width height
I am doing iOS 7 compatible app.
in iOS 7, I want to show of width 204 only, but in iOS 6 and earlier version, I want to show of width 300.
For this below is what I did.
-(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
if (IS_DEVICE_RUNNING_IOS_7_AND_ABOVE()) {
NSLog(@"changing font...");
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 204, 44)]; // your frame, so picker gets "colored"
label.textColor = [UIColor blackColor];
label.font = [UIFont fontWithName:localize(@"myFontName") size:14];
label.textAlignment = NSTextAlignmentCenter;
label.text = [arrayGender objectAtIndex:row];
return label;
} else {
[pickerView setFrame: CGRectMake(10, 264, 300, 216)];
pickerView.backgroundColor = [UIColor clearColor];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, 260, 44)];
label.textColor = [UIColor blackColor];
label.font = [UIFont fontWithName:@"HelveticaNeue-Bold" size:14];
label.text = [NSString stringWithFormat:@"%@", [arrayGender objectAtIndex:row]];
return label;
}
}
This is is working perfectly.
The problem comes in highlighter that is there. The highlighter size is fixed to 204 (this is the size-width set in IB for UIPicker)
Any idea how to tackle this highlighter?
By highlighter, below is sample what I meant.
Below is the actual image of what I am talking about.