如何将一个笔尖嵌入另一个笔尖?
在我当前的项目中,有许多视图共享公共部分,因此我只是想象一种将公共部分封装到 nib 文件中的方法,该文件可以通过将其嵌入到相应的 nib 文件中来由许多控制器共享。尽管我知道如何以编程方式完成此操作,但我仍然相信应该有一种方法可以在 Interface Builder 中简单地实现此目的。有没有人已经实现了这一目标,您愿意指出出路吗?
There are many view that share a common part in my current project so I just visualize a way to encapsulate the common part into a nib file that could be shared by many controllers by embedding it to their corresponding nib file. Although I know how to do it programmatically, I still believe there should be a way to achieve this simply in Interface Builder. Are there anyone who has achieved this and would you like to point the way out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
例如,您可以在 NIB 文件中添加一个名为“Content”的视图。在您的代码中,您唯一需要做的就是在“Content”视图中添加新的 UIViewController 视图。这样,您就可以实现保存通用数据的视图,而您要做的唯一一件事就是更改“内容”视图内的视图。
You can add in your NIB file a view called "Content", for example. In your code, the only thing you need to do is add your new UIViewController's view inside the "Content"'s view. This way, you can achieve a view that holds common data, while the only thing you do is to change the view inside the "Content"'s view.