'How can I forbid the rotation of status bar during the dismiss animation of a landscape viewcontroller?

I presented a landscape viewcontroller A on a portrait viewcontroller B, and hid the system status bar in A by overriding the prefersStatusBarHidden property to false.

After I called the dismiss method of A, it rotated back to B. Duration the rotation, the status bar of A appeared, scaled and rotated to the top of B.

How can I forbid the rotation of status bar during the dismiss/present animation, make it stay at the top of B?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source