Apple Watch中的布局

时间:2014-11-20 07:02:42

标签: iphone watchkit ios8-extension

我正在为Apple Watch制作一个计算器我已插入一个组,在里面我添加了4个按钮,但我找不到任何选项,这两个按钮应该在Apple Watch屏幕上调整。

Apple Watch 38mm

Screenshot

Apple Watch 42mm

Screenshot

组属性

Screenshot

按钮属性

enter image description here

2 个答案:

答案 0 :(得分:15)

每行使用一个WKInterfaceGroup,并在尺寸检查器中将“相对于容器”宽度设置为1,将高度设置为0.18。

enter image description here

在每个组布局中,您的WKInterfaceButtons设置相对于容器高度为1,宽度为0.25(每行4个元素)。

enter image description here

38毫米的最终结果:

enter image description here

和42mm:

enter image description here

答案 1 :(得分:1)

对于其他可能尝试在Apple Watch套件上执行类似操作的人,这里有一个非常好的基本计算器教程: http://www.noodlewerk.com/blog/calculator-apple-watch-tutorial/ (不是我自己的教程,而是我在自己试用套件时遇到的事情)

摘自文章:

“选择两个按钮并打开右侧边栏中的属性检查器。将宽度选项保持为'相对于容器',但将值从1更改为0.25。”

此百分比设置允许UI元素相对于显示区域重新调整大小,这在Apple Watch等有两种不同屏幕尺寸的情况下非常有用。