卡布奇诺 (objective-j) / Atlas 如何从图片中提取相对和绝对定位?

发布于 2024-09-27 01:19:42 字数 157 浏览 5 评论 0原文

我最近一直在查看 Cappuccino 和 Atlas,它们似乎将相对和绝对定位抽象为“有效”的东西。我想知道熟悉该项目的人 - 他们是如何做到这一点的?

我一直认为相对和绝对定位是一种晦涩的思考定位元素的方式,所以我对此很好奇。

我可以查看的任何帮助或资源都非常棒!

I've been checking out Cappuccino and Atlas lately, and they seem to have abstracted relative and absolute positioning away into something that just "works". I was wondering for those familiar with the project - how did they do this?

I've always thought that relative and absolute positioning is kind of an obscure way of thinking about positioning elements, so I'm really curious about this.

Any help or resources I could check out would be fantastic!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

通知家属抬走 2024-10-04 01:19:42

卡布奇诺使用可可视图模型。在常规 HTML 中,重点在于文本的布局,这就是为什么您可以使用“浮动”之类的东西来将一个文本块粘贴到另一个文本块中。

在 Cappuccino 中,对象的定位和大小更像桌面。您可以将小部件放置在具有固定坐标的“视图”层次结构中,并将它们“锚定”到屏幕的一侧或多侧(或父视图)。

它就像在 Cocoa 中一样,所以只需看看它在 Interface Builder 中的描述即可:

http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/IB_UserGuide/Layout/Layout。 html%23//apple_ref/doc/uid/TP40005344-CH19-SW9

弹簧和支柱
自动调整大小控件定义选定的
视图与其父视图的关系
框架。弹簧使视图发生变化
根据比例调整自身大小
其父视图的宽度或高度。
支柱使视图保持
自身与其自身之间的固定距离
沿着给定边缘的超级视图。

当然,在幕后,这一切都归结为使用 JavaScript 进行常规绝对定位来执行调整大小模型。

Cappuccino uses the Cocoa views model. In regular HTML the focus is on the layout of text, which is why you get things such as 'floats' to allow you to stick one block of text in another.

In Cappuccino, the positioning and sizing of objects is more desktop like. You position your widgets in a hierarchy of 'views' with fixed coordinates, and 'anchor' them to one or more sides of the screen (or the parent view).

It's like in Cocoa so just take a look at how it's described in the Interface Builder:

http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/IB_UserGuide/Layout/Layout.html%23//apple_ref/doc/uid/TP40005344-CH19-SW9

The springs and struts in the
autosizing control define the selected
view’s relationship to its parent
frame. A spring causes the view to
resize itself proportionally based on
the width or height of its superview.
A strut causes the view to maintain a
fixed distance between itself and its
superview along the given edge.

Of course, under the hood it all comes down to regular absolute positioning with JavaScript to execute the resizing model.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文