0

I try my best to explain what is happening.

I have updated the XCode to Version 10.1 (10B61)

And the iOS on my iPhone and Simulator is v12.1


My app has a TabController with 5 tabs.

First: Posts
Fifth: Profile Posts

These are embedded into a navigation controller (In case someone clicks on the comments button)

So. I've noticed that if I run my app and I click the comments, it pushes that vc in a weird way to the screen, then clicking back just "bumps" back. Also slide back isn't working.

However, if I switch tabs first then everything works fine.

VIDEO:

https://www.youtube.com/watch?v=fgS3j21L8Js

As you see in the video everything is fine after switching to Profile Posts + back .

UPDATE 1:

So if I start my app, switch to another Tab, then back to the original, it works fine.

Requested code:

func commentsButtonTapped(sender: UIButton) {
        let touchPoint:CGPoint = sender.convert(CGPoint.zero, to:self.tableView)
        if let indexPath = tableView.indexPathForRow(at: touchPoint) {
            openDetails(indexPath: indexPath, shouldShowKeyboard: false)
        }
    }
func openDetails(indexPath: IndexPath, shouldShowKeyboard : Bool) {
        if (self.tableView.cellForRow(at: indexPath) as? WorldMessageCell) != nil {

            let storyboard = UIStoryboard(name: "Additional", bundle: nil)
            let vc = storyboard.instantiateViewController(withIdentifier: "DetailsViewController") as! DetailsViewController

            vc.postId = PostIds.shared.nearby.ids[safe: indexPath.row]
            vc.shouldShowKeyboard = shouldShowKeyboard

            self.navigationController?.pushViewController(vc, animated: true)
        }
    }

UPDATE 2:

Solved the problem by forcing the TabController to switch between tabs..

override func viewDidAppear(_ animated: Bool) {

        self.selectedIndex = 1
        self.selectedIndex = 0

    }

But that's not how it should work..

UPDATE 3:

I have tested it, if I make the navigation controller->vc the initial vc (so no tab controller) everything works fine.

But as soon as the navigationcontroller is nested inside the tab, it happens.

I made a new project to test if this is a version specific bug but no, everything works fine there. So the issue must be with my app.

What could generate issue like that (in the video)?

Kárpáti András
  • 1,221
  • 1
  • 16
  • 35

1 Answers1

0

Ohh.. I have found the problem & bug:

So if you have navigation controllers nested into a tab controller that calls it's viewDidLoad() function, then the navigation controller will have problems.

The code I had to remove totally:

override func viewDidAppear(_ animated: Bool) {
        // here i had some code ... /

    }

Now everything works..

Kárpáti András
  • 1,221
  • 1
  • 16
  • 35