Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIDatePicker not displaying correctly

Basically this issue started when I updated my app to run with iOS 9. Without making any change in the code now a white square appears over the picker view, but it works normally.

enter image description here

Note that the user can hide and show the picker views and the cells they're in. If you need more info leave a comment.

UPDATE: Here is the full screenshot of the Table View:

screenshot

UPDATE 2: The following shows when I preview (press bar space button) the _pickerView property in the variables debugger. This makes me think the strange view is inside the UIDatePickerView and that it's a bug.

debugger screenshot

UPDATE 3: Extensive Research

So I finally did more research using the view inspector and the debugger and I got to some conclusion, although I still don't know how to solve it. Using the view hierarchy debugger I found out the the white strange view it's a UIPickerTableView inside the UIDatePicker.

White view selected in the view hierarchy debugger Here we can see the subject selected in blue and it's name at the top of the screen. I also wrote the whole hierarchy from the picker view to the subject so you can see it.

Next step was inspecting my datePicker var with the debugger to see if I could get to that UIPickerTableView causing problems. Inside it I could find 3 views, each one corresponding to each component (day, month, year). Let me show you the quick look of each one of these:

Click the pics to enlarge

In the first and the third one (day and year) we can see what look like some misplaced views next to the actual labels with the numbers. These properties, as you can see in the screenshot, are UIPickerColumnViews. I didn't go any further but you can imagine that if we inspect that property we would find the subject as a UIPickerTableView.

After all that I got to the conclusion that the misplacement of those views is what might be causing the issue. And that's all for today.

FINAL UPDATE

So some days after filing the bug report Apple answered and marked it as a duplicate. So I guess we just have to wait they fix it. You can check the radar at rdar://22566989

like image 423
Marc Avatar asked Sep 03 '15 11:09

Marc


1 Answers

Apple Developer Relations marked my bug report as a duplicate, so I guess it is an SDK bug that they'll have to solve. It is still open by the time of this post (12 Oct).

Workaround

In the viewDidLoad() method change a property of the date picker, for example the mode. You don't have to leave it changed, you can set it to anything and then change it back to what you actually want.

like image 144
Marc Avatar answered Oct 23 '22 15:10

Marc