I'm using Xcode beta 7 with the iOS9 simulator. Using a UIDatePicker with a datePickerMode of UIDatePickerModeTime only shows Hours, and not minutes.
See screenshot:
On iOS 7 and 8, obviously it works as expected, and shows both Hours and Minutes. Screenshot:
I really do not want to reinvent the wheel and roll my own time picker. Any ideas on why this might be happening and how to fix? I can't find anything on google.
thanks, Alex
I encountered this after the public release of iOS 9.0 with a UIDatePicker using UIDatePickerModeDate in my tableview.
I hacked around it by changing the UIDatePicker mode right before it was displayed, and then changing it back to the desired one:
[myDatePicker setDatePickerMode:UIDatePickerModeDateAndTime];
[myDatePicker setDatePickerMode:UIDatePickerModeDate];
I'm guessing redrawing it solves the issue. For interest's sake I don't think it's actually an issue of not displaying the minutes but rather a bug in the subviews because this is what mine looked like:
Inspecting using FLEX, this is part of the UIDatePicker that has a solid white background.
Found a useful description of this problem in the iOS 9 release notes - seems I should be reading these more carefully.
UIPickerView and UIDatePicker are now resizable and adaptive—previously, these views would enforce a default size even if you attempted to resize them. These views also now default to a width of 320 points on all devices, instead of to the device width on iPhone. Interfaces that rely on the old enforcement of the default size will likely look wrong when compiled for iOS 9. Any problems encountered can be resolved by fully constraining or sizing picker views to the desired size instead of relying on implicit behavior.
iOS 9 Release Notes
In my case all I had to do was remove all constraints on the UIDatePicker and then "Reset to Suggested Constraints". Rebuild and now all is well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With