将iOS Storyboard项目包含在另一个项目中? [英] Include an iOS Storyboard project into another one?
本文介绍了将iOS Storyboard项目包含在另一个项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我和其他人在同一个项目中工作,但是分开。想象一下,第一个人用UITableViewController创建一个Storyboard项目。第二个想要将前一个元素包含在他自己的Storyboard项目中。如何连接这两个Storyboard项目?
Me and other people work in the same project, but separately. Imagine that the first person creates a Storyboard project with a UITableViewController. The second one wants to include the previous element in his own Storyboard project. How can I connect these two Storyboard projects?
谢谢
推荐答案
我有一个解决方案:只需根据需要创建一个属性或变量。例如:
I have one solution: simply create a property or variable as appropriate. For example:
@property (strong, nonatomic) UIStoryboard * storyboard1;
@property (strong, nonatomic) UIStoryboard * storyboard2;
.....
.m
-(void)initMyStoryboards{
storyboard1 = [UIStoryboard storyboardWithName:@"storyboard1" bundle:nil];
storyboard2 = [UIStoryboard storyboardWithName:@"storyboard2" bundle:nil];
}
-(void)launchViewFromS1{
//use view in storyboard1
MyViewController1 *myViewController = [self.storyboard1 instantiateViewControllerWithIdentifier:@"MainView"];
....
}
-(void)launchViewFromS2{
//use view in storyboard2
MyViewController2 *myViewController2 = [self.storyboard2 instantiateViewControllerWithIdentifier:@"OtherView"];
....
}
其他例子:
-(void)launchMyView{
UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"storyboard1" bundle:nil];
ViewController1 *myViewController =[storyboard instantiateViewControllerWithIdentifier:@"MainView"];
....
}
这篇关于将iOS Storyboard项目包含在另一个项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文