[英]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.
我有一个选项卡式应用程序,第一个选项卡“ Home ”具有一系列6个按钮,其标签围绕7号圆形排列。
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. 我的
MainView
大小是W-any
, H-any
通用大小的VC。
My scrollView
is 451 pts
tall and 600 pts
wide. 我的
scrollView
高451 pts
,宽600 pts
。
My contentViews
are 320 pts
tall and 453 pts
wide. 我的
contentViews
高320 pts
,宽453 pts
。
My problem is that the views aren't working on the 6+, 5 or 4S screens. 我的问题是这些视图在6 +,5或4S屏幕上不起作用。
They only align properly on the 6 screen. 它们仅在6屏幕上正确对齐。
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. 我总是发现最有效的方法是使其变得非常简单,然后获得一些约束的IBOutlet并对其进行编码。 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 您甚至可以以编程方式创建视图(按钮/标签)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.