简体   繁体   中英

Size Classes with AutoLayout and ScrollView

Ok. I'm new to size classes. I have a tabbed application, and the first tab " Home " has a series of 6 buttons with labels arranged circularly around a 7th.

I have the hierarchy:

MainView  
-ScrollView
    -*ContentView1
        -Buttons/Labels
    -*ContentView2
        -Buttons/Labels

Looks like this:

一种
My MainView size is the W-any , H-any generic sized VC.
My scrollView is 451 pts tall and 600 pts wide.
My contentViews are 320 pts tall and 453 pts wide.

My problem is that the views aren't working on the 6+, 5 or 4S screens.
They only align properly on the 6 screen.

I'd like to be able to use size classes, but there is so much constraint activity going on, it's feeling a bit overwhelming.

I'm just looking for some advice/guidance on how to proceed. Perhaps even just some general principles to follow when using auto layout with size classes.

I always find the most productive thing is to make it very simple and then get IBOutlets of some constraints and code it. I always get stuck in issues like this. Believe me, coding such scenario is more elegant than using interface builder, besides you will make a reusable component (or at least function) that you can use later in other projects.

You can even create views (Buttons/Labels) programtically

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