[英]moving from tableview to another uiviewcontroller of the storyboard
when pressing a row of the table view I want to move in another screen of my storyboard. 当按表格视图的一行时,我想在情节提要的另一个屏幕中移动。
1) I do not want to use navigation controller, or do i have to? 1)我不想使用导航控制器,还是必须?
So I tried this code: 所以我尝试了这段代码:
UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc=[storyBoard instantiateViewControllerWithIdentifier:@"CenterMain"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentedViewController:vc animated:YES];
inside my (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
在我的
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
I am getting this warning: 我收到此警告:
Instance method '-presentedViewController:animated:' not found (return type defaults to 'id')
and this error when running: 并且在运行时出现此错误:
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) If using navigationController with this code: 2)如果使用带有以下代码的navigationController:
UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
[[self navigationController] pushViewController:[storyBoard instantiateViewControllerWithIdentifier:@"CenterMain"] animated:YES];
it works but the thing is that I do not want to see the bar of the navigation controller on the top. 它可以工作,但问题是我不想在顶部看到导航控制器的栏。
So I want either to helo with the 1, or tell how to erase the top bar in sollution 2. 因此,我想与1混合使用,或者告诉我如何在解决方案2中擦除顶部的条。
Thanks! 谢谢!
Use the UIViewController
- (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated
or - (void)setNavigationBarHidden:(BOOL)hidden;
使用
UIViewController
- (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated
或- (void)setNavigationBarHidden:(BOOL)hidden;
method. 方法。 So in your case,
所以就你而言
[[self navigationController] setNavigationBarHidden:YES];
if you just want it hidden, or: 如果您只想隐藏它,或者:
[[self navigationController] setNavigationBarHidden:YES animated:YES];
if you want to animate while hiding. 如果要在隐藏时进行动画处理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.