react-native-navigation的迁移库

123456789101112131415161718192021222324252627
  1. #import "Constants.h"
  2. #import "UIViewController+LayoutProtocol.h"
  3. @implementation Constants
  4. + (NSDictionary *)getConstants {
  5. return @{@"topBarHeight": @([self topBarHeight]), @"statusBarHeight": @([self statusBarHeight]), @"bottomTabsHeight": @([self bottomTabsHeight])};
  6. }
  7. + (CGFloat)topBarHeight {
  8. return [UIApplication .sharedApplication.delegate.window.rootViewController getTopBarHeight];
  9. }
  10. + (CGFloat)statusBarHeight {
  11. return [UIApplication sharedApplication].statusBarFrame.size.height;
  12. }
  13. + (CGFloat)bottomTabsHeight {
  14. @try {
  15. return CGRectGetHeight(((UITabBarController *) UIApplication.sharedApplication.windows[0].rootViewController).tabBar.frame);
  16. } @catch (NSException *exception) {
  17. return 0;
  18. }
  19. }
  20. @end