我和其他人在同一个项目中工作,但是分开。想象一下,第一个人用UITableViewController创建一个Storyboard项目。第二个想要在他自己的Storyboard项目中包含前一个元素。如何连接这两个Storyboard项目?
由于
答案 0 :(得分:1)
我有一个解决方案:只需根据需要创建一个属性或变量。例如:
@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"];
....
}