Xcode 中的 UIView 设备旋转 iPad/iPhone?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4427806/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
UIView device rotation iPad/iPhone in Xcode?
提问by Nitesh M
I am new in iPhone/iPad development I am getting a problem in rotation. I want to rotate a UIView
according to device rotation iPad/iPhone with full content with the size and position sometimes. Please help me out and give me sample code or any useful link.
我是 iPhone/iPad 开发的新手,我在轮换中遇到问题。UIView
有时我想根据设备旋转 iPad/iPhone 旋转带有完整内容的大小和位置。请帮助我并给我示例代码或任何有用的链接。
Thanks..
谢谢..
回答by Satya
If you want to rotate any view according to device rotation , Just goto Interface Builder and set the view sizes in the size inspector as shown in the following image.
如果您想根据设备旋转来旋转任何视图,只需转到 Interface Builder 并在大小检查器中设置视图大小,如下图所示。
or else, you can set using code,
否则,您可以使用代码进行设置,
view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
回答by Akshay
Go to Interface Builder -> Size Inspector ->AutoSizing
转到 Interface Builder -> Size Inspector -> AutoSizing
Select all the Outer Bars and Un-select the inner bars. :-)
选择所有外部钢筋并取消选择内部钢筋。:-)