2012-10-09 37 views
17

我有一個UITableView與書名。我也有一個視圖(AddAndEditBookViewController)來輸入關於這些書籍的信息。當我點擊桌面導航欄上的「+」時,我想打開我的AddAndEditBookViewController。如果我在單獨的nib文件中創建表格,我知道該怎麼做,但是如果我的視圖是在故事板中創建的(沒有陷入......此時更多用於學習目的),我該如何做到這一點。instantiateViewControllerWithIdentifier,但是xCode 4.5中的標識符在哪裏?

我看到我使用了storyboard的instantiateViewControllerWithIdentifier方法,但是如何找到我的視圖控制器的id?我試圖尋找故事板的XML表示,但我似乎沒有發現它...

下面是試圖打開模式視圖的代碼。

- (void)insertNewObject:(id)sender 
{ 
    AddAndEditBooksViewController * addViewController = (AddAndEditBooksViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"gH8-2m-MXv"]; 
    [addViewController setDelegate:self]; 
    [addViewController setModalPresentationStyle:UIModalPresentationFormSheet]; 
    [self presentViewController:addViewController animated:YES completion:NULL]; 
} 

我的具體問題是:我應該使用什麼標識符?它在哪裏指定,或者我如何手動指定它?

謝謝!

回答

35

它位於IB的Identity Inspector選項卡下。它被稱爲「故事板ID」。你可以給它任何你想要的唯一名字。

相關問題