嗨,我是iOS开发的新手,请给我一个从UIView导航到UIViewController的解决方案:这是我使用的代码,但无法正常工作
acceptedJobDetailViewController *acceptedJobDetailViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"acceptedJobDetailViewController"];
[self.navigationController pushViewController:acceptedJobDetailViewController animated:YES];
我也尝试下面的代码来推送viewcontroller,但是那也不起作用,请帮助我解决这个问题:
[appDelegate.navControl pushViewController:acceptedJobDetailViewController animated:YES];
最佳答案
请在情节提要中添加导航控制器。
step -1: select acceptedJobDetailViewController from storyboard.
step -2: now go to Editor>EmbedIn>NavigationController
step -3: now below code and run your project
acceptedJobDetailViewController *acceptedJobDetailViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"acceptedJobDetailViewController"];