iOS 8 / 7 UIWindow with UIWindowLevelStatusBar Rotation issue

前端 未结 3 1756
眼角桃花
眼角桃花 2020-12-12 01:41

I\'m trying to add a UIWindow with UIWindowLevelStatusBar level. it works in portrait mode on ipad perfectly but after rotating device its messed up.

on

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 02:10

    Solution for iOS8 (need a transform as showed above as well):

    UIScreen *screen = [UIScreen mainScreen];
    CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
    if ([screen respondsToSelector:@selector(fixedCoordinateSpace)])
    {
        [self setFrame:[screen.coordinateSpace convertRect:statusBarFrame toCoordinateSpace:screen.fixedCoordinateSpace]];
    }
    

    However it does not work for iOS9 beta.

提交回复
热议问题