xichen744/SPPage

强烈建议!!!KSTATUSBARHEIGHT和KNAVIGATIONANDSTATUSBARHEIGHT这两个宏的问题

Opened this issue · 0 comments

KSTATUSBARHEIGHT和KNAVIGATIONANDSTATUSBARHEIGHT这两个宏最好不要这样写死,兼容性不好,
建议这样写:
`- (CGFloat)statusBarHeight{
return CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
}

  • (CGFloat)navigationBarHeight{
    CGFloat height = 0;

    height += CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);

    height += CGRectGetHeight(self.navigationController.navigationBar.frame);

    return height;
    }`
    这样,无论导航栏和状态栏是否隐藏或者是iPhoneX或者更奇葩的屏幕都没问题。(请原谅我插入代码没效果)