The viewdidappear () of my controller is not called when I use it in the tab bar controller

0

What I want to do is that when I come from a 3d shortcut, force the tab bar controller to choose an index.

If I do this in the viewdidAppear() of the tab bar controller, the problem is that the viewDidAppear() of my main embedded driver is not called. If I click again on the tab bar item then it is already called.

With the rest of the controllers it does not pass. I understand why it is not the first one in the list of items in the tab bar controller.

Tab bar controller:

override func viewDidAppear(_ animated: Bool) {
    if goTasks {
        self.selectedIndex = 0
    } else if goTodo {
        self.selectedIndex = 2
    } else if goProjects {
        self.selectedIndex = 3
    } else if goSearch {
        self.selectedIndex = 0
    }

}

My index viewcontroller 0.

override func viewDidAppear(_ animated: Bool) {
    print(isSearchingServer)
}

If I do debug I can see that it does not get to enter this last viewdidAppear() . Any solution?

    
asked by Alejandro 29.03.2017 в 13:08
source

1 answer

0

I found the solution and it is in making the call to super.viewDidAppear ()

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    if goTasks {
        self.selectedIndex = 0
    } else if goTodo {
        self.selectedIndex = 2
    } else if goProjects {
        self.selectedIndex = 3
    } else if goSearch {
        self.selectedIndex = 0
    }
}
    
answered by 29.03.2017 в 13:22