2013-04-06 95 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,然后在故事板可以链接意见