NSLayoutConstraint+RQExtension.m 1013 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // NSLayoutConstraint+RQExtension.m
  3. // BuckDriverCoach
  4. //
  5. // Created by 张嵘 on 2018/12/21.
  6. // Copyright © 2018 lee. All rights reserved.
  7. //
  8. #import "NSLayoutConstraint+RQExtension.h"
  9. #import "RQWebViewViewController.h"
  10. @implementation NSLayoutConstraint (RQExtension)
  11. //按比例获取宽度 根据375的屏幕
  12. #define RQ_WIDTH(WIDTH) WIDTH * [UIScreen mainScreen].bounds.size.width/375.0
  13. - (void)setWidthScreen:(BOOL)widthScreen {
  14. if (widthScreen) {
  15. self.constant = RQ_WIDTH(self.constant);
  16. }else{
  17. self.constant = self.constant;
  18. }
  19. }
  20. - (BOOL)widthScreen {
  21. return self.widthScreen;
  22. }
  23. - (void)setToTop:(BOOL)toTop {
  24. if (toTop && IS_IPHONE_IPhoneX_All) {
  25. self.constant = self.constant + 22;
  26. }else {
  27. self.constant = self.constant;
  28. }
  29. }
  30. - (BOOL)toTop {
  31. return self.toTop;
  32. }
  33. - (void)setToBottom:(BOOL)toBottom {
  34. if (toBottom && IS_IPHONE_IPhoneX_All) {
  35. self.constant = self.constant + 34;
  36. }else
  37. self.constant = self.constant;
  38. }
  39. - (BOOL)toBottom {
  40. return self.toBottom;
  41. }
  42. @end