简体   繁体   English

通用布局与不同的iphone / ipad故事板

[英]Universal layout vs different iphone/ipad storyboards

Is it okay to use different storyboards for different screensizes? 是否可以使用不同的故事板进行不同的屏幕显示? I just can't make my png and icons images work for one storyboard as universal, it's a pain! 我只是不能让我的png和图标图像适用于一个故事板作为通用,这是一个痛苦!

What about universal iPhone and universal for iPad? 通用iPhone和iPad通用怎么样? What's the best way? 什么是最好的方式?

Thanks 谢谢

You can also use one storyboard and set layout and font according to your requirements. 您还可以使用一个故事板并根据您的要求设置布局和字体。

1) To set up layout properly for both iPhone and iPad, you need to use Aspect Ratio. 1)要为iPhone和iPad正确设置布局,您需要使用宽高比。 You can check the answer in detail following these two links: 您可以通过以下两个链接详细检查答案:

1) What constraints should be given to increase size of imageview with respect to device screen size without reducing image clarity 1) 在不降低图像清晰度的情况下,应该增加关于设备屏幕尺寸的图像视图尺寸的约束

2) Calculating Aspect Ratio for all sizes of iphone - It will work for both iPhone and iPad. 2) 计算所有尺寸的iphone的纵横比 - 它适用于iPhone和iPad。


2) To set different font size for iPhone and iPad, there is a setting in your storyboard, check the image. 2)要为iPhone和iPad设置不同的字体大小,故事板中有一个设置,请检查图像。

there is the + symbol near your Label . 您的标签附近有+符号。 For iPad , you need to set Regular height and regular width . 对于iPad ,您需要设置常规高度和常规宽度 And for iPhone it will take regular font size. 而对于iPhone,它将采用常规字体大小。 (AnyHeight , AnyWidth) . (AnyHeight,AnyWidth)

Check the screenshots for better understanding. 查看屏幕截图以便更好地理解。

在此输入图像描述

在此输入图像描述

Output :- 输出: -

在此输入图像描述

As a conclusion, you don't need to take different storyboards for iPhone and iPad. 总之,您不需要为iPhone和iPad采用不同的故事板。 I hope this answer will help you. 我希望这个答案会对你有所帮助。

Although you can use multiple storyboards for multiple screens it usually isn't necessary if the layout is similar enough. 虽然您可以将多个故事板用于多个屏幕,但如果布局足够相似,通常不需要。 Note at the bottom of the attributes inspector in the interface builder there is a box called installed. 请注意,在界面构建器的属性检查器底部有一个名为installed的框。 You can use this to specify what constraints go where. 您可以使用它来指定哪些约束在哪里。 Add the ones you want to the devices you want and remove them from the others. 将您想要的设备添加到您想要的设备中,然后将其从其他设备中删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM