UIDatePicker auto layout issue in iOS 10

Not able to align UIDatePicker. I created top, horizontal center and width(320) constraints. I also tried setting leading and trailing previously instead of width. But the date picker is always displayed outside the visible area

Replies

I'm also having this issue.

Having this issue as well, affects iOS 9 too. Probably an issue in Xcode 8 - has anyone filed a bug report?

Filed a bug report

Please post any bug numbers that have been filed.

Bug report number:

27081433

I'm assuming you are seeing the date picker draw itself at around twice its height? I also filed a bug report: rdar://27161028

It seems to be something to do with Xcode 8's storage of the date picker in the storyboard. For example, I downloaded the DateCell sample app, built and run in Xcode 8. App worked a-ok. Then, if I open its storyboard in the Xcode 8 editor (do nothing, just save it), build and run.... bug shows up. Comparing the original .storyboard of the sample app to the new one (after opening it in the editor) shows numerous differences.

Furthermore, the issue seems to only manifest itself if the date picker has any vertical contraints.

Regular pickers do not have this problem.

To my knowledge, there are no workarounds.

Xcode 8 Beta 2 has fixed at least rdar://27161028

I found a workaround. If you go into the Storyboard and manually misplace the date picker's frame (keep your same constraints), it will be positioned correctly when running on iOS 9 devices. Just don't push the "update frame" button. Don't ask me why this works. It defies all logic.

I am using xcode beta 3, still having problem with datepicker positioning.

Ya that workid for me. but is it safe to submit app with this kind of problem ? I am going to publish my app tomorrow . is it okay ? or this gonna create problem for iOS 9 users ?