gpt4 book ai didi

ios - 使用单个 Storyboard支持多种 iPhone 分辨率

转载 作者:可可西里 更新时间:2023-11-01 04:29:28 25 4
gpt4 key购买 nike

我们都将把我们的应用程序更新到 iphone 6 和 iphone 6 plus。这意味着我们需要支持 4 种尺寸。

1.) 3.5
2.) 4
3.) 4.7
4.) 5.5

我们能否通过单个 xib 或 Storyboard支持所有这些屏幕尺寸?另外,请分享您对我们如何为 iphone 6 和 iphone 6 plus 更新现有应用程序的看法。

最佳答案

是的。参见 Apple 的 iOS8 documentation具体来说,尺寸等级:

iOS 8 makes dealing with screen size and orientation much more versatile. It is easier than ever to create a single interface for your app that works well on both iPad and iPhone, adjusting to orientation changes and different screen sizes as needed. Design apps with a common interface and then customize them for different size classes. Adapt your user interface to the strengths of each form factor. You no longer need to create a specific iPad storyboard; instead target the appropriate size classes and tune your interface for the best experience.

There are two types of size classes in iOS 8: regular and compact. A regular size class denotes either a large amount of screen space, such as on an iPad, or a commonly adopted paradigm that provides the illusion of a large amount of screen space, such as scrolling on an iPhone. Every device is defined by a size class, both vertically and horizontally.

WWDC site 上也有很好的教程视频.

为了停止缩放您的 iPhone 6/6+ 应用程序,add a launch image of the correct size或者更好,使用发布 Storyboard。

从那里你应该使用 AutoLayout 并避免硬编码到屏幕尺寸。从长远来看,这将大大减少工作量和出错率。

关于ios - 使用单个 Storyboard支持多种 iPhone 分辨率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25888028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com