BUScreenHelper.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. //
  2. // BDUScreenHelp.h
  3. // BUAdSDK
  4. //
  5. // Created by bytedance_yuanhuan on 2018/11/28.
  6. // Copyright © 2018年 bytedance. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. //设备类型
  11. typedef NS_ENUM(NSInteger, BUDeviceMode) {
  12. //iPad
  13. BUDeviceModePad,
  14. //iPhone6plus,iPhone6Splus
  15. BUDeviceMode736,
  16. //iPhone6,iPhone6S
  17. BUDeviceMode667,
  18. //iPhone5,iPhone5C,iPhone5S,iPhoneSE
  19. BUDeviceMode568,
  20. //iPhone4,iPhone4s
  21. BUDeviceMode480,
  22. //iPhoneX,iphoneXS
  23. BUDeviceMode812,
  24. //iphoneXR,iphoneRS Max
  25. BUDeviceMode896
  26. };
  27. NS_ASSUME_NONNULL_BEGIN
  28. @interface BUScreenHelper: NSObject
  29. /**
  30. * 判断设备是iPhone4, iPhone4S
  31. *
  32. * @return Yes or No
  33. */
  34. + (BOOL)is480Screen;
  35. /**
  36. * 判断设备是iPhone5, iPhone5C, iPhone5S, iPhoneSE
  37. *
  38. * @return Yes or No
  39. */
  40. + (BOOL)is568Screen;
  41. /**
  42. * 判断设备是iPhone6,iPhone6S
  43. *
  44. * @return Yes or No
  45. */
  46. + (BOOL)is667Screen;
  47. /**
  48. * 判断设备是iPhone6plus, iPhone6Splus
  49. *
  50. * @return Yes or No
  51. */
  52. + (BOOL)is736Screen;
  53. // iphone6,iphone6 plus
  54. /**
  55. * 判断设备是iPhoneX,iphoneXS
  56. *
  57. * @return Yes or No
  58. */
  59. + (BOOL)is812Screen;
  60. /**
  61. * 判断设备是iphoneXR,iphoneRS Max
  62. *
  63. * @return Yes or No
  64. */
  65. + (BOOL)is896Screen;
  66. /**
  67. * 判断设备的宽度大于320
  68. *
  69. * @return Yes or No
  70. */
  71. + (BOOL)isScreenWidthLarge320;
  72. /**
  73. * 判断设备是iPad
  74. *
  75. * @return Yes or No
  76. */
  77. + (BOOL)isPadDevice;
  78. /**
  79. * 判断设备是iPad pro
  80. *
  81. * @return Yes or No
  82. */
  83. + (BOOL)isIpadProDevice;
  84. /**
  85. * 获取设备类型
  86. *
  87. * @return BUDeviceType类型
  88. */
  89. + (BUDeviceMode)getDeviceType;
  90. /**
  91. * 分辨率,区分横竖屏,形如@"414*736"
  92. * @return 横竖屏返回样式,横屏样式@"736*414",竖屏样式@"414*736"
  93. */
  94. + (nullable NSString *)resolutionString;
  95. /**
  96. * 分辨率,区分横竖屏,形如@"414x736"
  97. * @return 横竖屏返回样式,横屏样式@"736x414",竖屏样式@"414x736"
  98. */
  99. + (NSString *)displayDensity;
  100. @end
  101. NS_ASSUME_NONNULL_END