UINavigationController - pop animation bug

2020-07-06 05:17发布

I have trouble with animation of UINavigationController. I have master-detail view. On view one button, that's open detail view. Detail view opens correctly, with normal animation of header and with sliding of content. But when I click Back button, header animated correctly, and content of detail disappear in moment and not animated. Here is the link on demonstration of problem: https://www.youtube.com/watch?v=C4UApAhEhx8

For opening I use standard

AboutViewController *aboutViewController = [[AboutViewController alloc]   initWithNibName:@"AboutViewController_iPhone" bundle:nil];
[self.navigationController pushViewController:aboutViewController animated:YES];

I tried to pop view with code, no with back button, but there is same problem.

5条回答
Fickle 薄情
2楼-- · 2020-07-06 05:26

Please use the code for back to the previous window:

[self.navigationController pushViewController animated:YES];

I think it will help you.

查看更多
贪生不怕死
3楼-- · 2020-07-06 05:28

Please use the code for back to the previous window:

[self.navigationController popViewController animated:YES];
查看更多
Anthone
4楼-- · 2020-07-06 05:42

I have the exact same question as yours, and my problem is I set the selectedindex of tab bar in viewwillappear method of some view controller, this causes some bug of the navigation bar.

So I just simply move the code to viewdidappear, this fix the bugs.

Hope some day you may see this, even though you may already solve this. So hope this will help others.

查看更多
冷血范
5楼-- · 2020-07-06 05:44

This happens if somewhere in your code you are either forcing a call to one of the viewWillAppear counterparts with YES or NO instead of letting iOS decide, or if you mismatch calls to [super viewWillAppear:animated] with viewDidAppear.

查看更多
趁早两清
6楼-- · 2020-07-06 05:49

I had the same issue and Miha's answer pointed me in the right direction. In my case, I had a custom UITabBarController in which I was doing some processing in viewDidAppear. The problem was caused by the absence of [super viewDidAppear:animated]; in my viewDidAppear.

查看更多
登录 后发表回答