从其他屏幕激活UITabbarcontroller中的选项卡 [英] Activate Tab in UITabbarcontroller from other screen

查看:78
本文介绍了从其他屏幕激活UITabbarcontroller中的选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发的应用程序具有与其他内容交叉链接的内容.

I am developing an App with content that is crosslinked to other content.

该应用程序包含5个标签.每个选项卡都有它的Tableviews和detailsviews.从选项卡的detailview中,可以从另一个选项卡继续进行其他项目.

The App contains 5 Tabs. Each Tab has it's Tableviews and detailsviews. From the detailview of a Tab, one can proceed to other items from another tab.

例如:选项卡1> TableView列表类别> TableView列表项> DetailView> TableView交叉链接的项目>选项卡2> DetailView

For Example: Tab 1 > TableView List Categories > TableView List Items > DetailView > TableView crosslinked Items > Tab 2 > DetailView

(希望如此!:D)

当我通过tabbarController.selectedIndex = 1激活Tab 2时;它不会打开请求的detailview,而是打开TableView List Categories.

When I activate the Tab 2 by tabbarController.selectedIndex = 1; it doesn't open the requested detailview but the TableView List Categories.

有没有办法做到这一点?

Is there a way of doing this?

谢谢!

推荐答案

如果DetailView由UITableViewDelegate的willSelectRowAtIndexPath或didSelectRowAtIndexPath推送,则不仅需要切换选项卡,而且还可以直接发出上述调用或调用UITableView的selectRowAtIndexPath(后者更好).

If DetailView is pushed by willSelectRowAtIndexPath or didSelectRowAtIndexPath of your UITableViewDelegate, than you need not only switch tab, but issue above mentioned call directly or call selectRowAtIndexPath of your UITableView (latter is better).

更正!!!

我不在上面!!!selectRowAtIndexPath不会使委托接收到tableView:willSelectRowAtIndexPath:或tableView:didSelectRowAtIndexPath:消息.该怎么办?向您的TableViewController中添加新方法pushDetailViewController.比在didSelectRowAtIndexPath中轻松调用此新方法.现在在您的切换选项卡中接下来调用此方法pushDetailViewController的方法中.就是这样.

Correction!!!

I was not right above!!!! selectRowAtIndexPath doesn't cause the delegate to receive a tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath: message. What to do? add new method pushDetailViewController into your TableViewController. Than in didSelectRowAtIndexPath easy call this new method. And now in method where your switch tab next call this method pushDetailViewController. That's all.

这篇关于从其他屏幕激活UITabbarcontroller中的选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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