react-native-navigation的迁移库

Constants.m 734B

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