酷店

KDPHeightTool.m 876B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // KDPHeightTool.m
  3. // KuDianProject
  4. //
  5. // Created by admin on 2019/7/4.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPHeightTool.h"
  9. @implementation KDPHeightTool
  10. /**
  11. * 键盘安全区域
  12. *
  13. * @return 34
  14. */
  15. + (CGFloat)getSafeBottom{
  16. if (@available(iOS 11.0, *)) {
  17. return [UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom;
  18. } else {
  19. return 0;
  20. }
  21. }
  22. /**
  23. * tabbar 高度
  24. *
  25. * @return 49 + 安全区域
  26. */
  27. + (CGFloat)gettabbarHeight{
  28. return 49 + [self getSafeBottom];
  29. }
  30. /**
  31. * statusBar 高度
  32. *
  33. * @return 20 或 44(iPhone X)
  34. */
  35. + (CGFloat)getStatusBarHeight{
  36. return [[UIApplication sharedApplication] statusBarFrame].size.height;
  37. }
  38. /**
  39. * navigationBar 高度
  40. *
  41. * @return 64 或 88(iPhone X)
  42. */
  43. + (CGFloat)getNavigationBarHeight{
  44. return 44 + [self getStatusBarHeight];
  45. }
  46. @end