Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use SnapKit achieve the following requirements? view.width = (superView.width - 30) * 0.3 #788

Open
veryip7 opened this issue Nov 29, 2023 · 3 comments

Comments

@veryip7
Copy link

veryip7 commented Nov 29, 2023

view.width = (superView.width - 30) * 0.3

Please tell me if anyone knows,thanks.

@veryip7 veryip7 changed the title How to use SnapKit achieve the following requirements? view.width = (superView.width - 30) * 0.5 How to use SnapKit achieve the following requirements? view.width = (superView.width - 30) * 0.3 Nov 29, 2023
@au-murau
Copy link

au-murau commented Dec 5, 2023

view.width = (superView.width - 30) * 0.3

Please tell me if anyone knows,thanks.

Is it helpful for you?

if let superview {
   view.snp.makeConstraints {
      $0.width.equalTo((superview.frame.width - 30) * 0.3)
   }
}

@veryip7
Copy link
Author

veryip7 commented Dec 6, 2023

view.width = (superView.width - 30) * 0.3
Please tell me if anyone knows,thanks.

Is it helpful for you?

if let superview {
   view.snp.makeConstraints {
      $0.width.equalTo((superview.frame.width - 30) * 0.3)
   }
}

thank you,but the superView.frame.size.width is not fixed

@dragnea
Copy link

dragnea commented Dec 27, 2023

$0.width.equalToSuperview().offset(-30).multipliedBy(0.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants