无法推送ViewController iOS

我在我的应用程序中使用故事板, :我在我的Viewbutton,点击button我想导航到新的View

但是当我点击button没有任何反应,

这是我的代码:

 - (IBAction)JoinClicked:(id)sender{ JoinWithViewController *detail_view_controller = [[JoinWithViewController alloc] initWithNibName:@"JoinWithViewController" bundle:nil]; [self.navigationController pushViewController:detail_view_controller animated:YES]; } 

我在哪里犯错,请帮忙。

提前致谢。

在身份检查员的故事板中设置视图控制器的故事板ID

请参考你的故事板

 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 

然后到你的控制器

 YourController *vc = [storyboard instantiateViewControllerWithIdentifier:@"YourController"];// storyboardId [self.navigationController pushViewController:vc animated:YES]; 

而且你也可以让继续和做

 [self performSegueWithIdentifier:@"YourSegueIdentifier" sender:sender/nil]; 

使用这个:

 - (IBAction)JoinClicked:(id)sender{ [self performSegueWithIdentifier: @"JoinWithIdentifier" sender: self]; 

}

并像storyborad添加segue 在这里输入图像说明

在故事板中为您的push-segue制作一个标识符。

然后使用

 [self performSegueWithIdentifier:@"YourSegueIdentifier" sender:nil]; 

在使用故事板时,应尽可能多地使用赛格导航。

你的代码看起来不错,请确认你的socketsconfiguration是否正确,或不在xib或storyboard中。

编辑:你正在使用故事板,并希望xib文件被推到您的视图控制器,如果我没有错,你可以拖动故事板中的另一个视图控制器,并将其命名为JoinWithViewController和推button使用seguebutton单击。 这比你想要做的要容易得多。