简体   繁体   中英

Change view frame in landscape using autolayout in storyboard

I am very new to AutoLayout . I have one problem. I need to change the frame of any UIView when moving form portrait to landscape mode.

For example: If I have one UILabel with frame (100,100,100,30) in portrait mode. And I want to change its frame to (400,400,100,30) if rotate iPad to landscape mode. I want to do this using storyboard and auto layout.

I want to avoid coding for this.

I try this one :

First check Use AutoLayout

在此处输入图片说明

Move your mouse point to UILabel and drag right side with Ctrl Key and select Trailing space to container

在此处输入图片说明

Move your mouse point to UILabel and drag left side with Ctrl Key and select Leading space to container

在此处输入图片说明

This is your output :

在此处输入图片说明在此处输入图片说明

Check it. :)

This will help your in autolayout please see the given below images

应用屏幕截图1进行处理

应用屏幕截图2进行处理

应用屏幕截图3进行处理

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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