[英]moving from tableview to another uiviewcontroller of the storyboard
当按表格视图的一行时,我想在情节提要的另一个屏幕中移动。
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中擦除顶部的条。
谢谢!
使用UIViewController
- (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated
或- (void)setNavigationBarHidden:(BOOL)hidden;
方法。 所以就你而言
[[self navigationController] setNavigationBarHidden:YES];
如果您只想隐藏它,或者:
[[self navigationController] setNavigationBarHidden:YES animated:YES];
如果要在隐藏时进行动画处理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.