Pratyusha Terli
Pratyusha Terli

Reputation: 2343

How to avoid gap on top of UIPickerView

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

in this image

Upvotes: 2

Views: 2746

Answers (2)

IronManGill
IronManGill

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

Oh Seung Kwon
Oh Seung Kwon

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

Related Questions