Rakesh
Rakesh

Reputation: 1187

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.

Upvotes: 1

Views: 394

Answers (2)

Soumya Ranjan
Soumya Ranjan

Reputation: 4843

I try this one :

First check Use AutoLayout

enter image description here

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

enter image description here

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

enter image description here

This is your output :

enter image description here enter image description here

Check it. :)

Upvotes: 1

dheeru
dheeru

Reputation: 395

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

 Apply the process with screen shot 1

Apply the process with screen shot 2

Apply the process with screen shot 3

Upvotes: 0

Related Questions