美文网首页iOS 开发继续加油
获取导航栏,状态栏,tabBar高度

获取导航栏,状态栏,tabBar高度

作者: CombatReadiness | 来源:发表于2016-05-18 16:21 被阅读11037次

状态栏

CGFloat statusHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;

导航栏

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];(这儿取你当前tabBarVC的实例)
CGFloat tabBarHeight = tabBarVC.tabBar.frame.size.height;

toolBar

CGFloat toolBarHeight = self.navigationController.toolBar.frame.size.height;

相关文章

网友评论

    本文标题:获取导航栏,状态栏,tabBar高度

    本文链接:https://www.haomeiwen.com/subject/rjswrttx.html