iOS底部导航条的判断
一些低版本的iOS设备上是没有导航条的,所以在进行界面开发的时候需要向下兼容低版本的iOS设备,因此需要判断当前设备是否支持导航条。
objective-c 代码如下:
UIEdgeInsets insets;
if(@available(iOS 11.0, *)) {
insets = [UIApplication sharedApplication].delegate.window.safeAreaInsets;
} else {
insets = UIEdgeInsetsZero;
}
if(insets.bottom != 0){
//有导航条
}else{
//没有导航条
}
由于使用比较频繁,可以考虑封装起来,方便日常开发。