我在iOS应用程序中工作,但是当我点击我的一个场景中的按钮时,我试图呈现一个桌面视图,如下图所示:
我试过这种方式:
- (IBAction)presentScene:(id)sender
{
NSString *storyboardName = @"Main";
NSString *viewControllerID = @"myScene";
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle:nil];
MyViewController *controller = (MyViewController *)[storyboard instantiateViewControllerWithIdentifier:viewControllerID];
[self presentViewController:_categoViewController animated:YES completion:nil];
}
但是没有显示导航回到主表视图,或者我甚至无法设置tableview的标题。你们中的任何人都知道如何呈现tableview?
答案 0 :(得分:0)
试试这个:
[[self navigationController] pushViewController:YOUR_DESTINATION_VIEW_CONTROLLER animated:YES];
答案 1 :(得分:0)
你应该像hg log --rev [changeset] --template "{branch}\n"
一样展示tableViewController:
UINavigationController
修改强>
您应该在故事板中添加MyViewController *controller = (MyViewController *)[storyboard instantiateViewControllerWithIdentifier:viewControllerID];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentViewController:navigationController animated:YES completion:nil];
,如下所示:
如果您不想在UINavigationController
中显示navigationBar,请隐藏它:
HomeVC
最后,推送// HomeVC.m
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
:
MyViewController
答案 2 :(得分:0)
经过实验,我终于找到了我想要的东西:
self.tabBarController.selectedIndex = 1;