当按下表格视图的一行时,我想在我的故事板的另一个屏幕中移动。
1)我不想使用导航控制器,或者我必须使用?
所以我尝试了这段代码:
UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc=[storyBoard instantiateViewControllerWithIdentifier:@"CenterMain"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentedViewController:vc animated:YES];
在我的(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
我收到了这个警告:
Instance method '-presentedViewController:animated:' not found (return type defaults to 'id')
运行时出现此错误:
MainMap presentedViewController:animated:]: unrecognized selector sent to instance 0x72a2070
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainMap presentedViewController:animated:]: unrecognized selector sent to instance 0x72a2070'
2)如果使用带有此代码的navigationController:
UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
[[self navigationController] pushViewController:[storyBoard instantiateViewControllerWithIdentifier:@"CenterMain"] animated:YES];
它有效,但问题是我不想看到顶部的导航控制器栏。
所以我想要与1合作,或者告诉如何擦除溶剂2中的顶部条。
谢谢!
答案 0 :(得分:1)
使用UIViewController
- (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated
或- (void)setNavigationBarHidden:(BOOL)hidden;
方法。所以在你的情况下,
[[self navigationController] setNavigationBarHidden:YES];
如果您只是想隐藏它,或者:
[[self navigationController] setNavigationBarHidden:YES animated:YES];
如果你想隐藏动画。