基于选项卡的控制器连接问题
我有一个问题。
我有读取 RSS 提要的代码,它是基于导航的。
RssFunViewController - > >这就是表的视图(提要列表)
NewsDetailViewController - >这显示了有关用户选择的新闻源的更多信息(在新视图中)。
但是当我尝试在基于选项卡的导航项目中使用它时,它不起作用。我只是获得 RSS 提要表,当我单击某个项目时,我看不到详细视图。
我认为我的问题是与选项卡控制器和我的类的连接。
对于我的第三个导航选项卡,我将 RssFunViewController 设置为类。
我的问题是如何连接我的 RSSFunViewController 和 NewsDetailViewController,以便当用户单击该项目时我可以看到详细视图。
这是我的选项卡控制器中当前的连接: www.freeimagehosting.net/uploads/535e439c7f.jpg
谢谢大家。
I have an issue .
I have code that reads in RSS feeds, its navigation based.
RssFunViewController - > thats the view for the table (list of feeds)
NewsDetailViewController - > thats shows more information about the news feed which was selected by user (in a new view).
But when i try to use it in a tab-based navigation project it doesnt work. I just get the table of RSS feeds, When i click an item i dont see the detailed view.
I think my issue is the connection with the tab controller and my classes.
For my 3rd navigation tab I set RssFunViewController as the class.
My question is how do i connect my RSSFunViewController and NewsDetailViewController so when the user clicks the item I see the detailed view.
Heres my current connections in my tab controller:
www.freeimagehosting.net/uploads/535e439c7f.jpg
Thanks everyone.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许我不得不让你失望,但 iPhone 编码在拖放和连接点阶段之后有一个非常陡峭的学习曲线,在这个阶段你实际上必须理解事物并使用代码使它们工作。
尽管您提供的信息非常有限,但这里简要概述了如何处理表格单击操作。
该表应该将其委托和数据源连接到正确的类(可能是,但不一定是同一类)。
委托类应该包含一个方法
,当点击表条目时将调用该方法。然后,indexPath.row 将给出所点击条目的行号。
在此方法中,您可以提供另一个显示详细信息的视图控制器,例如:(
假设 NewsDetailViewController 将具有 setFeedId 方法等),
或者您可以在 nib 文件中实例化 NewsDetailViewController,以便您可以跳过 alloc 和 initWithNibName 步骤,并且放置一个“IBOutlet NewsDetailViewController *ndvc;”在头文件中,以便您可以连接它们。
要从点击的行中删除突出显示,请执行以下操作:
如果您正在处理提供的项目,您应该能够找到类似的行已经存在。祝你好运。
Maybe I have to disappoint you, but iPhone coding has a very steep learning curve past the drag&drop and connect the dots phase, where you actually have to understand things and make them work using code.
Although the information you give is very limited, here's a brief outline of how the table click action could be handled.
The table should have it's delegate and data source connected to the right class (may be, but does not have to be the same class).
The delegate class should contain a method
which will be called when a table entry is tapped. indexPath.row will then give the row number of the tapped entry.
In this method, you could present another view controller showing details, e.g. like:
(assuming the NewsDetailViewController would have a setFeedId method etc.)
or you could have the NewsDetailViewController instantiated in your nib file so you could skip the alloc and initWithNibName steps, and put an "IBOutlet NewsDetailViewController *ndvc;" in the header file so you can connect them.
To remove the highlight from the tapped row, do
If you're working on a supplied project, you should be able to find lines like these already lying around. Good luck.