gpt4 book ai didi

ios - 在 iOS 中创建响应式设计——我做得对吗?

转载 作者:行者123 更新时间:2023-11-29 01:59:08 26 4
gpt4 key购买 nike

我没有太多在 iOS 应用程序中使用响应式设计的经验。

我一直在使用 Photoshop 图像的比例编写自定义 View ,然后在自定义 UIView 类中将其键入,如下所示是我创建的 View 的示例:

    let contentX = bounds.width * 0.05
let contentWidth = bounds.width * 0.9
let titleY = bounds.height * 0.1037
let titleHeight = bounds.height * 0.35556
let buttonY = titleY + titleHeight + (bounds.height * 0.126)
let buttonHeight = bounds.height * 0.31111
let backWidth = contentWidth * 0.3
let problemsX = (contentWidth * 0.35) + contentX
let problemsWidth = contentWidth * 0.65

为了计算这些比例,我将进入 Photoshop 并找到 x、y 坐标以及宽度和高度,然后将 x 和宽度除以 View 的总宽度,将 y 和高度除以 View 的高度风景。这为我提供了一个十进制数,无论 View 的尺寸如何,我都可以使用它来查找 UIElement 的大小和原点。

这是一项繁琐的工作,我做得对吗?

我觉得这似乎是一个主观问题,所以请限制这些约束的答案,不要给我你个人的主观意见,请仅引用著名的风格指南或技术。有替代软件吗?

最佳答案

使用 AutoLayout,这就是它的用途。

Note: You are talking about doing "Responsive Design", not "Reactive Design". ("Responsive Design" = "make it so that the UI adapts to the screen size". "Reactive" is another, totally different concept related to how to design the workflow of your data in your app, like by using ReactiveCocoa and such). Maybe you should edit your question and title to make it clearer ;-)

关于ios - 在 iOS 中创建响应式设计——我做得对吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30547913/

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