我想推动ViewController而不使用塞格,但它不工作。 我的按钮的代码如下:呼叫故事板没有segue
-(void)consultaButton
{
NSString *storyboardName = @"Main";
NSString *viewControllerID = @"Consultas";
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle:nil];
EntradaViewController *controller = (EntradaViewController *)[storyboard instantiateViewControllerWithIdentifier:viewControllerID];
[self presentViewController:controller animated:YES completion:nil];
}
EntradaViewController/ENTRADA =起源的ViewController ConsultasViewController/Consultas =目标的ViewController
我有错误:
2013-12-12 14:42:51.519 JuntaComercial[14285:70b] -[EntradaViewController consultaButton:]: unrecognized selector sent to instance 0x9e51650
可能有人给我帮助吗?我已经在使用塞格并且工作正常,但现在我需要在没有塞格的情况下也这样做。感谢名单!
更新(工作代码):
-(void)consultaButton:(id)sender
{
NSString *storyboardName = @"Main";
NSString *viewControllerID = @"Consultas";
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle:nil];
EntradaViewController *controller = (EntradaViewController *)[storyboard instantiateViewControllerWithIdentifier:viewControllerID];
[controller setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:controller animated:YES completion:nil];
}
项目中.storyboard文件的名称是什么?这是为故事板名称设置的名称。 –
已更新... Main.storyboard。但问题仍然存在。 – AllMac
我认为Wain请尝试更改方法处理程序: - (void)consultaButton:(id)发件人,或者如他所建议的那样,修改按钮操作代码 –