12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- //
- // NSLayoutConstraint+RQExtension.m
- // BuckDriverCoach
- //
- // Created by 张嵘 on 2018/12/21.
- // Copyright © 2018 lee. All rights reserved.
- //
- #import "NSLayoutConstraint+RQExtension.h"
- #import "RQWebViewViewController.h"
- @implementation NSLayoutConstraint (RQExtension)
- //按比例获取宽度 根据375的屏幕
- #define RQ_WIDTH(WIDTH) WIDTH * [UIScreen mainScreen].bounds.size.width/375.0
- - (void)setWidthScreen:(BOOL)widthScreen {
- if (widthScreen) {
- self.constant = RQ_WIDTH(self.constant);
- }else{
- self.constant = self.constant;
- }
- }
- - (BOOL)widthScreen {
- return self.widthScreen;
- }
- - (void)setToTop:(BOOL)toTop {
- if (toTop && IS_IPHONE_IPhoneX_All) {
- self.constant = self.constant + 22;
- }else {
- self.constant = self.constant;
- }
- }
- - (BOOL)toTop {
- return self.toTop;
- }
- - (void)setToBottom:(BOOL)toBottom {
- if (toBottom && IS_IPHONE_IPhoneX_All) {
- self.constant = self.constant + 34;
- }else
- self.constant = self.constant;
- }
- - (BOOL)toBottom {
- return self.toBottom;
- }
- @end
|