简体   繁体   English

iOS中的自动旋转问题

[英]Auto rotation issues in ios

I am developing a custom application for ios 7 in xcode 5.i am using auto layout.I have a scene from a story board as follows. 我正在使用自动布局在xcode 5.i中为ios 7开发自定义应用程序。我有一个故事板上的场景,如下所示。 Its in the potrait mode. 它处于potrait模式。 在此处输入图片说明

when i rotate it to the landscape mode it becomes as follows 当我将其旋转到横向模式时,它变成如下 在此处输入图片说明

i want the landscape image o be as follows. 我希望景观图像如下。 在此处输入图片说明

how can i achieve this? 我怎样才能做到这一点?

There are simple auto layout feature which help you to make your view like you desire. 有简单的自动布局功能,可帮助您使视图如您所愿。

For the view on the left, choose from the Editor\\Pin menu: Top Space to Superview Leading Space to Superview For the view on the right, choose: Top Space to Superview Trailing Space to Superview And for the big view at the bottom: Leading Space to Superview Trailing Space to Superview Bottom Space to Superview 对于左侧的视图,请从“编辑器” \\“ Pin”菜单中进行选择:顶部空间以Superview引导空间到Superview右侧视图中,选择:Top Space以Superview跟踪尾随空间Superview底部的大视图:Leading观看空间尾随空间观看底部空间

if you want to learn auto layout there is a good tutorial fro you http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1 如果您想学习自动版式,这里有一个很好的教程http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1

from your question I got that you want to make the red view size and origin wont change after rotation. 从您的问题中得知,您希望旋转后红色视图的大小和原点不会改变。

Use width, height, left, and top in autolayout. 在自动版式中使用宽度,高度,左侧和顶部。 It makes red view position always in top left without any size changed. 它使红色视图位置始终在左上角,而无需更改任何大小。

在此处输入图片说明

Here the results : 结果如下:

Before rotation 旋转前

在此处输入图片说明

After rotation 旋转后

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM