2013-04-06 59 views
0

Iam使用故事板做一個項目,在一個viewcontroller中我有一個按鈕。當我點擊它時,它將移動到下一個viewcontroller,但它的一個單獨的xib文件。現在我試圖將aback按鈕添加到該xib文件所以我可以移回到我的故事板,但它不工作形式我?工具欄後退按鈕不起作用

我嘗試下面的代碼從廈門國際銀行移動到故事板視圖 - 控制

viewcontrollerOne *list= [self.storyboard instantiateViewControllerWithIdentifier:@"detail"]; 
[self presentModalViewController:list animated:YES]; 

請讓我知道爲什麼它不工作的原因嗎?

+0

如果你想將其添加爲programmetically然後http://stackoverflow.com/questions/14704686/how-to-add-bar-buttons-in-a-uitoolbar/14704726#14704726 – iPatel 2013-04-06 06:02:51

+0

請閱讀我題。 – Naveen 2013-04-06 06:04:02

+0

@Naveen,請檢查你是否在該故事板上爲該類提供了標識符名稱,如果是,請嘗試使用此方法代替presentModalViewController,因爲它已被棄用:[self presentViewController:list animated:YES completion:nil]; – 2013-04-06 06:32:32

回答

0

,當你想從廈門國際銀行移動到故事板一個視圖控制器,它的工作對我來說這代碼將工作。

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"IDENTIFIER"]; 
[self.navigationController pushViewController:vc animated:YES]; 
2

你可以嘗試改變你的項目的UINavigationController,然後在故事板可以鏈接意見