Need to display 4 UIPickerView in ViewController.
How can i customise height?
Minimum height we can given is 162. Can i give 100 height for each UIPickerView? Is there any framework or example available?
Need to display 4 UIPickerView in ViewController.
How can i customise height?
Minimum height we can given is 162. Can i give 100 height for each UIPickerView? Is there any framework or example available?
Try this:
UIPickerView *picker = [[UIPickerView alloc] initWithFrame: CGRectZero];
picker.showsSelectionIndicator = YES;
picker.autoresizingMask = UIViewAutoresizingFlexibleWidth;
CGSize ps = [picker sizeThatFits: CGSizeZero];
picker.frame = CGRectMake(0.0, 0.0, ps.width, ps.height + 100);
Try with following code, it may be work in you case:
self.MyPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
For Other tips check This Answer
For UIPickerView
there are only three Height : 162,180,216. You can use CGAffineTransformMakeTranslation
and CGAffineTransformMakeScale
for properly fit to picker.
CGAffineTransform t;
CGAffineTransform s;
CGAffineTransform u;
UIPickerView *pickerview;
t = CGAffineTransformMakeTranslation (0, pickerview.bounds.size.height);
s = CGAffineTransformMakeScale (1.0,0.5);
u = CGAffineTransformMakeTranslation (0 ,pickerview.bounds.size.height);
pickerview.transform = CGAffineTransformConcat (t, CGAffineTransformConcat(s,u));
Here the above code changes the height of picker view.
If you don't mind clipping the ends, you can embed it inside of a smaller view, with clipping enabled.