在其他地方分配/初始化视图后,如何从 XIB 重新加载视图?

发布于 2025-01-05 08:22:16 字数 272 浏览 4 评论 0原文

我正在研究一种动画效果,其中视图(包含按钮、标签等子视图)在屏幕上显示为一个非常小的视图,所有子视图紧密地间隔在一起,并且视图动画为全屏,所有子视图改变他们的最终位置。

我以编程方式完成所有这些工作,但我希望能够使用 XIB 来布置所有内容的最终位置。但是,如果我使用 XIB 作为最终布局,当视图首次加载时,它将在最终位置显示子视图。

有什么方法可以为此使用 2 个独立的 XIB,一个用于初始布局,一个用于最终布局?有没有办法获取已经创建的视图,并使用 XIB 来获取已存在的子视图的布局位置?

I'm working on an animation effect where a view (containing subviews like buttons, labels etc.) appears on screen as a very small view with all the subviews spaced closely together, and the view is animated to full-screen and all the subviews change to their final positions.

I'm doing all of this programmatically, but I'd like to be able to use a XIB to lay out the final positions of everything. If I use the XIB for the final layout, however, when the view first loads it will show the subviews in their final positions.

Is there any way I can use 2 separate XIBs for this, one for the initial layout and one for the final layout? Is there any way to take a view that has already been created, and use a XIB to just get the layout positions of the already-existing subviews?

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

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

发布评论

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

评论(1

许一世地老天荒 2025-01-12 08:22:16

Nib 文件存储为归档对象图,因此从中获取任何信息的唯一方法是取消归档它们,这会实例化 nib 中所有对象的新版本。

我想如果您真的愿意,您可以这样做,然后使用笔尖中的视图框架来设置原始视图中的视图框架。

No. Nib files are stored as archived object graphs, so the only way to get any information out of them is to unarchive them, which instantiates a new version of all the objects in the nib.

I guess if you really wanted, you could do that, and then use the frames of the views in the nib to set the frames of the views in your original view.

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