Activate tab in UITabbarcontroller from another screen

I am developing an application with content stitched with other content.

The application contains 5 tabs. On each tab there are tables and detailed descriptions. From the tab view, you can go to other elements from another tab.

For example: Tab 1> TableView list categories> TableView list items> DetailView> Stitched TableView items> Tab 2> DetailView

(Hope that makes sense !: D)

When I activate Tab 2 using tabbarController.selectedIndex = 1; it does not open the requested detailed view, except for the categories of the TableView list.

Is there any way to do this?

Thanks!!

0
source share
1 answer

If the DetailView is pressed with the willSelectRowAtIndexPath or didSelectRowAtIndexPath command of your UITableViewDelegate, you need to not only switch the tab, but also issue the aforementioned call directly or call selectRowAtIndexPath of your UITableView (the latter is better).

Correction!!!

I have not been higher above !!!! selectRowAtIndexPath does not force the delegate to receive the table View: willSelectRowAtIndexPath: or tableView: didSelectRowAtIndexPath: message. What to do? add a new pushDetailViewController method to your TableViewController. Than it was easy to call this new method in didSelectRowAtIndexPath. And now in the method where your switch tab is next, call this method pushDetailViewController. It's all.

0
source

Source: https://habr.com/ru/post/1392211/


All Articles