在多个故事板文件之间共享场景。 iPhone与iPad [英] Sharing scene between multiple storyboard files. iPhone vs iPad
问题描述
我正在使用故事板进行通用应用。我有2个故事板文件。一个用于iPhone,另一个用于iPad。我将有一些场景,我想在两者之间分享,我想使用故事板编辑器来设置它们。常见的是UITableViewController及其原型单元。我可以在一个故事板文件中制作它,但如何在不重做其设计的情况下在两个文件中显示它?
I'm working on a Universal app using storyboarding. I have 2 storyboard files. One for iPhone and one for iPad. I will have a handful of scenes that I would like to share between both and I want to use the storyboard editor to set them up. A common one is a UITableViewController and its prototype cells. I can make it in 1 of the storyboard files but how do I show it in both files without redoing its design?
推荐答案
我不要认为这是可能的,虽然它会很酷。您可以拥有第三个用于公共视图的故事板,但是必须以编程方式对这些视图进行细分。
I don't think that's currently possible, though it would be cool. You could have a third storyboard that was for common views but segues to those views would have to be done programmatically.
创建第三个故事板的实例后,您可以[storyboard instantiateViewControllerWithIdentifier:STRING_ID]来获取它的实例。
Once you create an instance of that third storyboard, you can do [storyboard instantiateViewControllerWithIdentifier:STRING_ID] to get an instance of it.
这是我在我的一个应用程序中所做的,我有一些共享的常用工具。
This is what I did in one of my apps where I had some common tools that were shared.
这篇关于在多个故事板文件之间共享场景。 iPhone与iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!