Vikings
Vikings

Reputation: 2527

iPhone Orientation Change

I know how to do an orientation change, but lets say you have a view with buttons, labels, ect. The autoresizing distorts 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.

Upvotes: 0

Views: 704

Answers (2)

Tim Kozak
Tim Kozak

Reputation: 4182

My sandbox app: https://github.com/comonitos/programatical_device_orientation

The solution is easy

Upvotes: 0

Jhaliya - Praveen Sharma
Jhaliya - Praveen Sharma

Reputation: 31730

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

Upvotes: 1

Related Questions