我想推動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)發件人,或者如他所建議的那樣,修改按鈕操作代碼 –