iosuipickerviewuipickerviewcontroller

Decrease the margin of content of UIPickerView ios


Modification due to the first 2 answers : what I want to modify is not the height of the UIPickerview. What I want is to make the content of UIPicker begins from the upper side of UIPicker. Here is an example: enter image description here

I want to delete the margin shown in the image here attached.I want to Kg(s) to be located at the upper border of UIPickerView, no the middle part

Any idea?

With a toolbar, the UIPickerView is embedded in a UIView. So the view hierarchy is : View(parent)->Toolbar(child), UIPickerView(child)

The View is declared as customPicker in my viewController. Here is the code: In viewController.h :

@interface myViewController:UIViewController<UIPickerViewDataSource, UIPickerViewDelegate>

@property (weak, nonatomic) IBoutlet UIView *customPicker;

@end

In viewController.m :

- (void) viewDidLoad{
self.customPicker.frame = CGRectMake(0, CGRectGetMaxY(self.view.frame), CGRectGetWidth(self.customPicker.frame), CGRectGetHeight(self.customPicker.frame));
    [self.view addSubview:self.customPicker];
}

Then I use a setPickerHidden method to animate the View in order to show or hide it.

Thanks in advance for your help!


Solution

  • That is not possible. If you need differently styled "UIPickerView" you will to roll your own.