I know how to do an orientation change, but lets say you have a view with buttons, labels, ect. The autoresizing di开发者_如何学Cstorts and makes the view look strange. What's the accepted way to do this, do I just create a portrait and landscape view. If so where would I actually do the swapping of these views.
Do all kind of resizing and reposition in your layoutSubviews
method of UIView
.
Once the orientation is changed, your layoutSubviews
would be called then you can know the current orientation by using UIDevice
class. and reposition your views child accordingly
UIDevice
property to be used for getting current orientation .
@propertyic,readonly) UIDeviceOrientation orientation
My sandbox app: https://github.com/comonitos/programatical_device_orientation
The solution is easy
精彩评论