开发者

iPhone Orientation Change

开发者 https://www.devze.com 2023-02-28 06:09 出处:网络
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 th

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

0

精彩评论

暂无评论...
验证码 换一张
取 消