iOS bottom navigation bar

Determining the navigation bar at the bottom of iOS
Some lower version iOS devices do not have a navigation bar, so when developing the interface, it needs to be backward compatible with lower version iOS devices. Therefore, it is necessary to determine whether the current device supports the navigation bar.
The objective-c code is as follows:

UIEdgeInsets insets;
if(@available(iOS 11.0, *)) {
    
    
	insets = [UIApplication sharedApplication].delegate.window.safeAreaInsets;
} else {
    
    
    insets = UIEdgeInsetsZero;
}
if(insets.bottom != 0){
    
    
	//有导航条
}else{
    
    
	//没有导航条
}

Since it is used frequently, you can consider encapsulating it to facilitate daily development.

Guess you like

Origin blog.csdn.net/weixin_44758107/article/details/127808022