IOS system navigation bar flickering problem


Someone in the technology group has raised such a question before, but I didn’t reproduce it in my demo. Later, the same problem occurred in the project, and the performance on IOS 12 was normal. The phenomenon is shown below

IOS system navigation bar flickering problem

Abnormal display of system navigation bar

After repeated tests, it is found that the conditions for this problem are:

1. Large page color difference 1

2. Navigation bar istranslucent = true

3. Bottom label bar istranslucent = true

4. Hidesbottombarwhenpushed = true when pushing

5. The navigation bar of page 2 is not hidden (this is nonsense), and whether the navigation bar of page 1 is hidden is not important


1、self.tabBar.isTranslucent = false

2、navigationController?.navigationBar.isTranslucent = false

3、hidesBottomBarWhenPushed = false

These three solutions are relatively restrictive, which can be regarded as a solution. For example, if the transparency of the label bar is not important, you can use method 1

4、navigationController?.navigationBar.setBackgroundImage(UIColor.white.withAlphaComponent(0.8).toUIImage(), for: .default)

5. Customize navigation bar

6. Use third-party libraries to solve problems, such as ypnavigationbartransition, kmnavigationbartransition, rtrootnavigationcontroller, qmui, etc

There are two problems found during the use of kmnavigationbartransition. I mentioned issues on GitHub:

1、navigationController?. navigationBar. Shadowimage setting is abnormally invalidThere are ways to deal with it

2、navigationBar. Istranslucent = true, if the page background color is different, it will jump and flickerThe effect is not as good as the effect of the system itself, and there is no response method for the time being

Recommended Today

Advanced Redux

The last article explained how to use redux. This article will further study the middleware mechanism of Redux from the source code of redux.Here we will take oneredux-thunkTake middleware as an example, and gradually decompose how the intermediate mechanism of Redux operates and executes. If you don’t have much gossip, go to the code. How […]