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

Attach view to different edges or use priorities #270

Open
SemyonovE opened this issue May 18, 2023 · 0 comments
Open

Attach view to different edges or use priorities #270

SemyonovE opened this issue May 18, 2023 · 0 comments

Comments

@SemyonovE
Copy link

Hi! Can I use some priorities or attach anchor of the view to more than one view?
I have header with attaching in top of the base view, and grey view below the header. But when my base view compressed I want compress header.

Default:
Screenshot 2023-05-18 at 6 36 16 PM

Compressed:
Screenshot 2023-05-18 at 6 36 26 PM

Code:

headerView.pin
    .top()
    .horizontally()
    .margin(.edgeInset)

greyView.pin
    .below(of: headerView)
     .horizontally()
    .bottom()
    .minWidth(.zero)
    .minHeight(.zero)
    .margin(.spacer, .edgeInset, .edgeInset)

And also what am I doing wrong? I should set minimum dimensions of the grey view, cos when I compress base view a lot from correct size, greyView has previous frame (I think this is cos some computed values of the greyView frame is negative).

For example (without .minWidth(.zero).minHeight(.zero)):
Screenshot 2023-05-18 at 6 39 34 PM

I would like to use .bottom() for headerView with low priority maybe.
I can use some calculations with sizeThatFits of the views, but want to solve this issue only by library with internal autoSizeThatFits of the views.

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

1 participant