2012-01-06 154 views
0

我和其他人在同一個項目中工作,但分開工作。假設第一個人用UITableViewController創建一個Storyboard項目。第二個想要在他自己的Storyboard項目中包含前一個元素。我如何連接這兩個Storyboard項目?將iOS Storyboard項目包含到另一個項目中?

謝謝

+0

你可以使用一個軟件版本系統(也稱爲SVN)。否則,你必須手動合併。 – 2012-01-06 10:23:49

+0

我不認爲版本控制在這裏會有所幫助。故事板是沒有文檔的XML,我不想嘗試在SVN中合併它們... – 2012-01-06 16:20:17

回答

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"]; 
    .... 
} 
相關問題