Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the status bar height in iOS Extension

I can get the status bar from UIApplication in normal app by

[UIApplication sharedApplication].statusBarFrame

But we cannot access UIApplication from Extension.Is there a way to find get the statusbar in share?

like image 572
guhan0 Avatar asked Feb 04 '16 09:02

guhan0


1 Answers

You may use safeAreaLayoutGuide to calculate layout frame. eg,

viewController.view.safeAreaLayoutGuide.layoutFrame.minY
like image 142
Jerome Li Avatar answered Oct 04 '22 17:10

Jerome Li