在其他地方分配/初始化视图后,如何从 XIB 重新加载视图?
我正在研究一种动画效果,其中视图(包含按钮、标签等子视图)在屏幕上显示为一个非常小的视图,所有子视图紧密地间隔在一起,并且视图动画为全屏,所有子视图改变他们的最终位置。
我以编程方式完成所有这些工作,但我希望能够使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.