MoZhouqi / KMNavigationBarTransition

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.
MIT License
3.38k stars 455 forks source link

Navigation bar flashing on iOS 14 #158

Open toto263 opened 4 years ago

toto263 commented 4 years ago

When the screen is changed, navigation bar color is flashing on iOS 14. I applied latest iOS 14 patch, and it is better, but still flashing.

before iOS 14 patch: https://youtu.be/iv23TxJsXmU

after iOS 14 patch: https://youtu.be/Y-zH8mqzWf0

MoZhouqi commented 3 years ago

@toto263 Hi, there are three patch versions, are any of them working properly?

toto263 commented 3 years ago

@toto263 Hi, there are three patch versions, are any of them working properly?

I applied the patch on KMNavigationBarTransition/UIViewController+KMNavigationBarTransition.m only.

if (@available(iOS 14, *)) {
    bar.items = @[[UINavigationItem new]]; // fix Apple's bug in iOS 14
}

Is there any other patches?

toto263 commented 3 years ago

Yes I can, but it will take some time to make a demo. Do you really need it?

On Sat, Sep 19, 2020 at 2:32 PM Zhouqi Mo notifications@github.com wrote:

@toto263 https://github.com/toto263 Hi, could you give me a demo to reproduce the problem?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MoZhouqi/KMNavigationBarTransition/issues/158#issuecomment-695358138, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV5AGXEBSQPTYDH47UTMITSGUPO7ANCNFSM4RSVWGEQ .

MoZhouqi commented 3 years ago

@toto263 Hi, there are three patch versions, are any of them working properly?

I applied the patch on KMNavigationBarTransition/UIViewController+KMNavigationBarTransition.m only.

if (@available(iOS 14, *)) {
    bar.items = @[[UINavigationItem new]]; // fix Apple's bug in iOS 14
}

Is there any other patches?

The release 1.16, 1.1.7 and 1.1.8 are three patches respectively.

toto263 commented 3 years ago

I tried three patches (1.1.6, 1.1.7, 1.1.8), and they work almost same. I can't find any differences between them. Now I am using 1.1.8.

toto263 commented 3 years ago

I could solve my issue by adding the following lines at _kmaddTransitionNavigationBarIfNeeded of UIViewController+KMNavigationBarTransition.m

- (void)km_addTransitionNavigationBarIfNeeded {
...
    bar.barStyle = self.navigationController.navigationBar.barStyle;
    bar.tintColor = self.navigationController.navigationBar.tintColor;
    bar.translucent = self.navigationController.navigationBar.translucent;
    if (@available(iOS 13.0, *)) {
        bar.standardAppearance = self.navigationController.navigationBar.standardAppearance;
    bar.scrollEdgeAppearance = self.navigationController.navigationBar.scrollEdgeAppearance;
    }
...
}

I am not sure if I need to add the same code elsewhere such as __kmviewDidAppear, km_popViewControllerAnimated, km_popToViewController, kmpopToRootViewControllerAnimated.

MoZhouqi commented 3 years ago

I could solve my issue by adding the following lines at _kmaddTransitionNavigationBarIfNeeded of UIViewController+KMNavigationBarTransition.m

- (void)km_addTransitionNavigationBarIfNeeded {
...
    bar.barStyle = self.navigationController.navigationBar.barStyle;
    bar.tintColor = self.navigationController.navigationBar.tintColor;
    bar.translucent = self.navigationController.navigationBar.translucent;
    if (@available(iOS 13.0, *)) {
        bar.standardAppearance = self.navigationController.navigationBar.standardAppearance;
  bar.scrollEdgeAppearance = self.navigationController.navigationBar.scrollEdgeAppearance;
    }
...
}

I am not sure if I need to add the same code elsewhere such as __kmviewDidAppear, km_popViewControllerAnimated, km_popToViewController, kmpopToRootViewControllerAnimated.

So can this problem be reproduced on iOS 13?

toto263 commented 3 years ago

I could solve my issue by adding the following lines at _kmaddTransitionNavigationBarIfNeeded of UIViewController+KMNavigationBarTransition.m

- (void)km_addTransitionNavigationBarIfNeeded {
...
    bar.barStyle = self.navigationController.navigationBar.barStyle;
    bar.tintColor = self.navigationController.navigationBar.tintColor;
    bar.translucent = self.navigationController.navigationBar.translucent;
    if (@available(iOS 13.0, *)) {
        bar.standardAppearance = self.navigationController.navigationBar.standardAppearance;
    bar.scrollEdgeAppearance = self.navigationController.navigationBar.scrollEdgeAppearance;
    }
...
}

I am not sure if I need to add the same code elsewhere such as __kmviewDidAppear, km_popViewControllerAnimated, km_popToViewController, kmpopToRootViewControllerAnimated.

So can this problem be reproduced on iOS 13?

I had no problem with iOS 13. It happened after iOS 14 update.