IOS9 displaying status bar with user uiwindow - wrong position

I am trying to cover the status bar with my own view and do this in order to calculate the frame for my view by doing something similar (also after rotation):

UIScreen *screen = [UIScreen mainScreen]; CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; 

For iOS8 + (because ios8 UIScreen is orientation dependent):

 CGRect frame = [screen.coordinateSpace convertRect:statusBarFrame toCoordinateSpace:screen.fixedCoordinateSpace]; [self setFrame:frame]; 

For iOS7:

 [self setFrame:statusBarFrame]; 

It works great for iOS8 and below, but when creating my application with Xcode 7 beta 4 and iOS 9 SDK, something is wrong when you launch the application in landscape or upsidedown (it works fine if the application runs in portrait) ...

i.e. when I launch the application, while the Upsidedown user uiwindow, which should cover the status bar, always ends at the bottom of the screen, any ideas what might be wrong?

+7
objective-c ios9 statusbar uiscreen uiwindow
source share
1 answer

Without additional information, the best solution would be to simply hide the status bar. If you still need a “status bar” for animation purposes or for some other reason, a typical solution in this case is to simulate this method by calling

- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates on UIScreen

and use the return view as a background for any view / window that you represent. Starting with iOS 9, there is no public method that will allow you to determine the specific behavior that you specified.

0
source share

All Articles