Jatin Patel - JP
Jatin Patel - JP

Reputation: 3733

Pop animation is not working in first UINavigationController of UITabbarController

I don't know what is wrong with my code. i have developed app successfully and all the things working fine except when i launch app first time, In side first navigation controller, the pop animation is not working fine. it seems that Pop without animation. and its working fine when i changed the tab and come back on first tab. and doing push-pop then its working fine.

I tried to figure out problem since week. but could't get success because of lengthy code. I have tried the same animation with creating Tabbar Demo and its working fine.

My app has following hierarchy.

UINavigationController --> UIViewController --> UITabbarController --> Four UINavigationController --> UIViewControlle.

I have taken UITabbarController in my storyboard.

Upvotes: 2

Views: 1615

Answers (2)

Gerges Eid
Gerges Eid

Reputation: 1075

For Swift 5

Depending on @Jatin Patel - JP answer

Create custom class for your TabBarController

Add this Code in your UITabBarController file

class MyTabBarController: UITabBarController {
  override func viewDidLoad() {
      super.viewDidLoad()
  }

  override func viewDidAppear(_ animated: Bool) {
      super.viewDidAppear(animated)
   }
 }

Upvotes: 0

Jatin Patel - JP
Jatin Patel - JP

Reputation: 3733

I know that i asked the question and also provide solution for same. I have asked this question long time ago and i am not getting any solution for this because there is illogical bugs. Not every Tabbar base application have same. Here i am adding solution that is result of long time debugging and i found that even single line can break your project.

Actually i have added UITabbarController from storyboard and programmatically created UITabbarController class and type cast it with UITabbarController inside storyboard.

Here my problem is, i forgot to write [super viewDidAppear:animated]; inside -(void)viewDidAppear:(BOOL)animated method. so i will break pop animation first time then it will work fine.

After getting this solution, even i don't know how this line affect whole code. but i don't want the other people to waste their time to find out such single line (unexpected issue) problem. so here i am adding this code.

-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
}

Upvotes: 12

Related Questions