Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to adapt ios13 statusbar?

When I run my project on ios13 xcode11 beta.

[UIApplication sharedApplication].statusBarFrame.size.height

the code returns 0.

what should I do to adapt it to ios13 ?

like image 954
Sunxb Avatar asked Jul 01 '19 09:07

Sunxb


People also ask

Can we change status bar color in iOS?

You can change the status bar colour just with a single line of code. Just updated the markdown for iOS 13 and below.

How do I change the color of my status bar in iOS 13?

To change the StatusBar background colour, i have created a base class of UIViewController so that i can inherit same code in all the view controllers. Added "statusBarColorChange()" to UIViewController extension. Created Base Class and inherited in other classes. Show activity on this post.


1 Answers

Use UIStatusBarManager to get the statusBar height in iOS13:

UIStatusBarManager *manager = [UIApplication sharedApplication].keyWindow.windowScene.statusBarManager;

CGFloat height = manager.statusBarFrame.size.height;
like image 138
Tamarous Avatar answered Nov 14 '22 23:11

Tamarous