如何从情节提要中的didSelectRowAtIndexPath打开视图控制器? [英] How to open view controller from didSelectRowAtIndexPath within storyboard?

查看:76
本文介绍了如何从情节提要中的didSelectRowAtIndexPath打开视图控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有tabbarcontroller的情节提要.标签栏之一具有表格视图,我希望当用户从表格视图中点击一行时打开一个详细视图.问题是,当我打开详细信息视图选项卡栏和导航栏隐藏时...在情节提要中,我将详细信息视图创建为新的视图控制器,然后创建一个新文件,并将其引用到详细信息视图的类.

I have a storyboard with tabbarcontroller. One of tab bar has a tableview and I want that when the user tap in a row from tableview open a detail view. The problem is when I open detail view tab bar and navigation bar hides... In the storyboard I create the detail view as a new view controller, then I create a new file and referred it to the class of detail view .

didselectrowatindexpath中的代码:

The code in didselectrowatindexpath:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath  *)indexPath {

detalleYouTube *dvController = [[detalleYouTube alloc] init];

[self.navigationController pushViewController:dvController animated:YES];

}

提前谢谢!

推荐答案

我假设您将详细信息"视图作为情节提要的一部分(不在单独的XIB中),如果需要,则需要在此处放置一个单独的NavigationController 详细信息" TabBarItem序列的开始.

I presume you have the 'Detail' view as part of the storyboard (not in a separate XIB), if so you will need to place a separate NavigationController at the start of the 'Detail' TabBarItem seque.

此页面上有一个很好的教程,介绍了我认为您要达到的目标: http://maybelost.com/2011/10/tutorial-storyboard-in-xcode-4-2-with-navigation-controller-and-tabbar-controller-part1/

This page has a good tutorial on what I think your trying to achieve: http://maybelost.com/2011/10/tutorial-storyboard-in-xcode-4-2-with-navigation-controller-and-tabbar-controller-part1/

还可以通过以下链接查看更深入的Storyboard教程:

Also check these links to a more in-depth Storyboard tutorial:

http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1

http://www.raywenderlich.com/5191/beginning-storyboards-in-ios-5-part-2

这篇关于如何从情节提要中的didSelectRowAtIndexPath打开视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆