本机应用如何实现“响应式"? [英] How do native apps pull off being "responsive"?

查看:83
本文介绍了本机应用如何实现“响应式"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为一个不熟悉本地移动应用程序基础而不是响应式网站的人,我正在尝试把机制似乎似乎很基本的东西笼罩在脑海中.然而,在这里搜索和不错的旧Google却让我空手而归.

As someone who is less familiar with the underpinnings of native mobile apps than responsive websites, I'm trying to wrap my head around the mechanics of something that seems like it ought to be fairly basic. And yet, searching here and good old Google has left me empty-handed.

当然,响应性网站依赖于媒体查询和断点来确定它们应如何以及在何处显示浏览器中的元素和内容.结果是用户几乎可以在任何设备上获得相同的体验.但是最终结果也是本机应用程序完成的,不是吗?如果用户在两个不同的Android或iOS手机上具有相同的应用程序,则UI(在大多数情况下)呈现一致.显然,他们没有使用浏览器. 应用程序开发人员是否使用类似于媒体查询的内容?本机应用程序如何知道在具有多种不同分辨率的许多设备上显示UI的方式?

Responsive websites, of course, rely on media queries and breakpoints to determine how and where they should display elements and content within a browser. The upshot is that the user gets the same experience on almost any device. But that end result is also what native apps accomplish, isn't it? If a user has the same app on two different Android or iOS phones, the UI is rendered (for the most part) consistently. Obviously, they aren't using a browser. Do app developers use something similar to media queries? How do native apps know which way to display a UI across many devices with many different resolutions?

推荐答案

在iOS中,通常在Interface Builder中使用Autolayout和Constraints,但也可以在代码中进行操作.从本质上讲,这些规则使您可以设置规则,以使事情在彼此之间/相对于应用程序框架的相对位置正确.

In iOS you use Autolayout and Constraints, usually in the Interface Builder but you can also do it in code. Essentially these let you setup rules which keep things in the right place 'relative' to each other / the frame of your app.

当我最近开始阅读这两篇出色的文章时,它们很有帮助: - http://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2 - http://www.raywenderlich. com/115444/auto-layout-tutorial-in-ios-9-part-2-constraints

These two great articles were helpful when I started with them recently: - http://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2 - http://www.raywenderlich.com/115444/auto-layout-tutorial-in-ios-9-part-2-constraints

这篇关于本机应用如何实现“响应式"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆