Search code examples
objective-cuipickerview

Custom height UIPickerView ios 8


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!


Solution

  • 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).