I’m trying to make a pickerview with simular values as the UIDatePicker and to make it look good I need to set the component widths to the same as the 4 columns in the date picker so I need the widths of the columns in point value please.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Disclaimer: I know there is no supported way to do that, the suggestion below is an invitation to experiment if you are not afraid of hacks.
The docs state:
It is a hint that one of
UIDatePicker‘s subviews is aUIPickerView(the fact check is left as an exercise to the original poster). You can iterate throughUIDatePicker‘s subviews and find theUIPickerView. Now,UIPickerViewresponds torowSizeForComponent:, which should return the correct size for each column. If you see absurd values, make sure you do that after theUIPickerViewcompleteslayoutSubviews(send itsetNeedsLayoutandlayoutIfNeeded).Even if the above works out right, you should be aware it’s a hack which may break with any iOS update. Take extreme caution.