2014-12-05 80 views
0

我是iOS编程的新手。ios8,后退按钮消失在'NavigationViewController'

问题是,当故事板将它改回按钮,这是属于“NavigationViewController”,

突然失踪。

enter image description here正如你看到有后退按钮。

enter image description here点击按钮后缺失后退按钮。

enter image description here这是我的第二个故事板的起点。

- (IBAction)resultClick:(UIButton *)sender { 
NSLog(@"결과 보기 버튼 클릭"); 
UIStoryboard *secondStoryboard =[UIStoryboard storyboardWithName:@"Second" bundle:nil]; 
UIViewController *initialSecondVC = [secondStoryboard instantiateInitialViewController]; 
initialSecondVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
[self presentViewController:initialSecondVC animated:YES completion:nil]; 

} - >这是按钮在第一个故事板中点击时的动作。

在此先感谢。

回答

1

原因是因为你指定你的segue是模态的(UIModalTransitionStyleFlipHorizo​​ntal)。 模式转换确实被推到右边,所以它没有按钮可以返回。

你可以做一个push segue(这是一个默认的删除样式的行,并确保故事板中的segue被设置为push)或添加一个按钮(某处)来解除segue。

0

在你的代码有这样一行:

initialSecondVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 

UIModal是一种莫代尔赛格瑞充当创建一个新的观点。如果你想拥有后退按钮的功能,你需要使用Push Segue而不是Modal。这是使用(ctrl +拖动)时给出的选项之一。

如果你想回去,但还是希望有好的过渡情态让你在你的代码(UIModalTransitionStyleFlipHorizontal)提供,则需要嵌入你的第二个视图控制器的导航控制器和放置的UIBarButtonItem在导航栏中,将其命名为“<”,并将其作为-(IBAction) backButton: (UIBarButtonItem) sender;连接,并使用您使用的相同代码转到第二个视图控制器返回。