Reputation: 2343
As shown in this image Im facing issue with UIPickerView.There is gap at the top as you can see.I wnat to remove that gap.Anyone know the solution for this.Any help is much appreciated.Thank you in advance
Upvotes: 2
Views: 2746
Reputation: 7226
Try something like this :-
[Picker addTarget:self action:@selectorAction) forControlEvents:UIControlEventValueChanged];
UIView *view = [[Picker subviews] objectAtIndex:0];
[view setBackgroundColor:[UIColor clearColor]];
[[[view subviews] objectAtIndex:0] setHidden:YES];
[[[view subviews] lastObject] setHidden:YES];
You can add the picker to a view and make a subview out of it .
Upvotes: 1
Reputation: 431
There is a only way to avoid gap top of UIPickerView
Change the frame of a picker. Like this.
smallerPicker = [[UIPickerView alloc] init];
smallerPicker.frame = CGRectMake(0.0, 0.0, 320.0, 165.0)
OR
smallerPicker.transform = CGAffineTransformMakeScale(.5, 0.5);
like change the scale of picker
Upvotes: 0