我已经开始使用 segue 来执行 View Controller 之间的导航。这就是我执行从 EPSearchResultController 到目标 viewcontroller 的 push segue 的方式。
//.h file
@property (strong, nonatomic) EPSearchResultController *obj_EPFirstViewController;
//.m File
- (IBAction)submitEPSearchQuery:(id)sender {
[self performSegueWithIdentifier:@"searchResultSegue" sender:sender];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"searchResultSegue"])
{
self.obj_EPFirstViewController = (EPSearchResultController*)[segue destinationViewController];
self.obj_EPFirstViewController.searchAgainDelegate = self;
NSDictionary* resultDict= [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"SearchResult" ofType:@"plist"]];
self.obj_EPFirstViewController.searchResultArray = [resultDict objectForKey:@"Result"];
}
}
问题:
当我从目的地返回到 EPSearchResultController 时,它显示黑屏。我正在使用
返回#pragma mark - Search Again Delegate
-(void)moveBack{
[self.navigationController popViewControllerAnimated:YES];
}
任何人都知道为什么它显示黑屏。
最佳答案
1) 检查 Storyboard 中 segue 的呈现样式。它可以是:
- 推送
- 模态
- 自定义
2) 使用正确的 dismiss 方法。
如果 Push,使用 [self.navigationController popViewControllerAnimated:YES]
如果模态,[self dismissViewControllerAnimated:YES completion:];
关于ios - 无法使用 Storyboard执行 segue back,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22961275/