Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置

时间:2022-11-11 12:39:33

So I have the following layout in storyboards, everything works fine on the 3x screen sizes but I would like to try and tidy up the font sizes and the position of the button icon relative to the button text.

我在故事板中有如下布局,在3x屏幕大小上一切都很好,但是我想尝试整理字体大小和按钮图标相对于按钮文本的位置。

See below what I mean, basically what I want is for each screen size to look very similar to the 4.7 screen layout e.g. the spacing between the text and the icons (also how can I get the font to scale down slightly on the 4 inch screen as it looks too big but ok on the rest of the screens.

基本上见下我的意思是,我想要的是为每一个屏幕大小看起来非常类似于4.7屏幕布局如文本和图标之间的间距(也我怎样才能在4英寸屏幕上字体略有缩减,因为它看起来太大了,但其余的屏幕上。

Any idea what constraints I need to put on the icons and text to get it to look the same on each screen size.

我需要在图标和文本上设置什么约束来让它在每个屏幕上看起来都一样。

2 个解决方案

#1


2  

In auto layout use multiplayer to increase and shrink the element. Please see the example below:

在自动布局中,使用多人游戏来增加和缩小元素。请看下面的例子:

Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置 Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置

Now run your app and check in all device type. Hope this will work for you.

现在运行您的应用程序并检查所有设备类型。希望这对你有用。

#2


0  

If you are using autolayout, you can set aspect ratio constraints for width and height of the imageView to the cell content view, that way, if the cell grows image will grow too.

如果您正在使用autolayout,您可以将imageView的宽度和高度的纵横比约束设置为单元格内容视图,这样,如果单元格也会增长图像的话。

The following link might be useful http://candycode.io/how-to-set-up-different-auto-layout-constraints-for-different-screen-sizes/

下面的链接可能很有用:http://candycode.io/howto -set- difference -auto-layout-constraint -for- difference -screen-sizes/

#1


2  

In auto layout use multiplayer to increase and shrink the element. Please see the example below:

在自动布局中,使用多人游戏来增加和缩小元素。请看下面的例子:

Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置 Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置Xcode故事板——如何在不同的iPhone屏幕尺寸之间改变字体大小和元素的位置

Now run your app and check in all device type. Hope this will work for you.

现在运行您的应用程序并检查所有设备类型。希望这对你有用。

#2


0  

If you are using autolayout, you can set aspect ratio constraints for width and height of the imageView to the cell content view, that way, if the cell grows image will grow too.

如果您正在使用autolayout,您可以将imageView的宽度和高度的纵横比约束设置为单元格内容视图,这样,如果单元格也会增长图像的话。

The following link might be useful http://candycode.io/how-to-set-up-different-auto-layout-constraints-for-different-screen-sizes/

下面的链接可能很有用:http://candycode.io/howto -set- difference -auto-layout-constraint -for- difference -screen-sizes/