Reputation: 814
I am setting a custom height and width to the UIPickerView with
mypicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 0.0, myWidth, myHeight)];
While it works perfectly on simulator ios 10, it ignores the custom height and width on ios 8. Is there a way do this in ios 8?
I tried CGAffineTransform and it didn't work.
Many thanks in advance!
Upvotes: 0
Views: 225
Reputation: 534977
The reason this doesn't work on iOS 8 is that the ability to provide your own height was not introduced until iOS 9. In iOS 8, the picker view will resist any attempts at changing its height; there is a narrow legal range of heights, and any attempt to set the height outside that range will just fail (and to add to the misery, the legal range is undocumented).
Upvotes: 1
Reputation: 1096
There are only three valid heights for UIPickerView (162.0, 180.0 and 216.0).
You can use the CGAffineTransformMakeTranslation and CGAffineTransformMakeScale functions to properly fit the picker to your convenience.
For more information this link and this link may help .
Happy to help!
Upvotes: 1