狀態(tài)欄
CGFloat statusBarH = 0;
if (@available(iOS 13.0, *)) {
UIWindowScene *windowScene = (UIWindowScene *)[UIApplication sharedApplication].connectedScenes.allObjects.firstObject;
statusBarH = windowScene.statusBarManager.statusBarFrame.size.height;
} else {
statusBarH = [[UIApplication sharedApplication] statusBarFrame].size.height;
}
導(dǎo)航欄
CGFloat navigationHeight = self.navigationController.navigationBar.frame.size.height;
tabBar
//在tabBarController中使用(你的繼承自UITabBarController的VC)
CGFloat tabBarHeight = self.tabBar.frame.size.height;
//在非tabBarController中使用
UITabBarController *tabBarVC = [[UITabBarController alloc] init];(這兒取你當(dāng)前tabBarVC的實例)
CGFloat tabBarHeight = tabBarVC.tabBar.frame.size.height;
toolBar
CGFloat toolBarHeight = self.navigationController.toolBar.frame.size.height;
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者