uidatepicker getting distorted, need help
In my app i am showing UIDatePicker
and its getting distorted for some reason.
UIDatePicker
. I am not rotating this view. I am just showing this view from an another view
which was in landscape mode
. In fact I am not changing the rotation of this view at all.
you can see in the pics below what exactly happening
here is the pic of IB.
and the pic of simulator.
PS: i also tried to create the pick开发者_如何转开发er from code and still the same result. Thanks for your help.
What NR4TR said is right. Since the previous view is in landscape, the picker is getting distorted. You can try saving the IB (containing the picker view) in landscape mode. I hope that will solve the problem.
I ran into the same problem. When you load a view while already in Landscape orientation the UIPicker is not rendered correctly. I spent several hours trying to find a workaround until I found a fix from this page from Llamagraphics. You add this code in viewDidLoad of the view controller that has the picker:
for (UIView* subview in myPicker.subviews) {
subview.frame = myPicker.bounds;
}
Visit the webpage for more details. Thank you Stuart!
When datepicker comes from the view that have been in landscape mode it tries to adjust it's frame horizontally automatically and there is no way to prevent it. You have to rotate your view back to portrait and then reinitialize the picker explicitly after changing the orientation.
精彩评论