开发小知识点记录

2020-11-06  本文已影响0人  iOS_Yang
  1. 获取状态栏高度
CGRect statusBarFrame;
    if (@available(iOS 13.0, *)) {
        statusBarFrame = [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager.statusBarFrame;
    }else {
        statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
    }
  1. 判断是否刘海屏
- (BOOL) isLHP {
    if ([[UIDevice currentDevice] userInterfaceIdiom] != UIUserInterfaceIdiomPhone) {
        // 如果设备不是手机
        return NO;
    }
    if (@available(iOS 11.0, *)) {
        UIWindow *window = [UIApplication sharedApplication].windows.firstObject;
        if (window.safeAreaInsets.bottom > 0) {
            return YES;
        }
    }
    return NO;
}
  1. vc.hidesBottomBarWhenPushed push页面,隐藏tabbar,在14系统使用多次,在使用popToRootViewControllerAnimated:回到首页,如果设置的yes,即需要动画,tabbar依然隐藏,如果使用false,不需要动画,则没问题。
    如果只是使用一次hidesBottomBarWhenPushed,回来也是正常。其它系统暂无问题。

  2. tableview 的cell,在上面增加子视图,需要放置在contentView上,不然在14系统可能不显示。

  3. 目前发现的statusBar的高度有(均在iOS14环境下):
    iPhone11:48
    iPhone11Pro:44
    iPhone11ProMax:44
    iPhone12mini:50
    iPhone12/12Pro:47
    iPhone12ProMax:47

上一篇 下一篇

猜你喜欢

热点阅读