ReversedcigoL
ReversedcigoL

Reputation: 71

How to make constraints work for landscape and portrait (xcode 8.1 / swift3 / storyboard)

I'm currently trying to make constraint work in both portrait and landscape view.

I started out putting controls to an iPad Pro 9.7 inch portrait view:

enter image description here

With a hierarchy:

enter image description here

I had to put two views to force it to center when the user switches to landscape view. I was able to center it but it seemed that scrolling won't work properly. I have to scroll up to see the upper part but once I release, it goes back to that position again.

enter image description here

Is there a way to solve this using the storyboard? I tried everything like:

-Top space, leading space, trailing space, bottom space, centerX, centerY to - but it became unscrollable

Upvotes: 0

Views: 339

Answers (1)

Amrit Tiwari
Amrit Tiwari

Reputation: 980

I have done it in two way.

  1. Using Stack View.

  2. Scroll View as your requirement.

    I have added the image and all the design are done in storyboard so I am giving you git link. Demo Project Link Hope it will help for you. enter image description here enter image description here

Upvotes: 1

Related Questions