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

Shrink and Expand the UIView with its child UIView components shrinking as well through PanGesture. #55

Closed
yashbedi opened this issue Jan 30, 2018 · 2 comments
Labels

Comments

@yashbedi
Copy link

yashbedi commented Jan 30, 2018

Hey hie thanks for the Awesome Library =D .

So there's a small problem which I'm facing
I was able to add a pan gesture in the View which is inherited from BaseView in ViewController inherited from BAseViewController . (Followed the same approach which is in the Example code of the library swift).

The below gif shows my requirements.
This thing is done from storyboard I'm trying it using FlexLayout.

So here(in the gif) I added the priorities to UIVIew with Autolayout then made an IBoutlet of NSLayoutConstraint
so when I swipe up using PAN gesture the view Expands and while sliding down the view shrinks (so as the constraints.constant value). So all the sliding up and down is done on that Iboutlet of NSLayoutConstraint.constant value (I mean I modify the value so the view changes its height with :usingSpringWithDamping effect)

imageedit_3_3530390270

But in FlexLayout I Couldn't get the constraints.constant value . I know FlexLayout lays out the view.. but How to achieve the above scenario with FlexLayout.

Looking for immediate help.
Thanks =)

[P.S. Sorry for hiding the details, there are some copyright thingy issues.]

@lucdion
Copy link
Member

lucdion commented Jan 30, 2018

Hi @yashbedi,

It's difficult to answer your question without having the full example, if you can share it your FlexLayout test, I could answer you correctly.

Currently you probably have something like that:

UIView.animate(withDuration: animated ? duration : 0) {
     myConstraint.constant = isExpanded ? 100 : 20
     view.layoutIfNeeded() 
}

Changing that to FlexLayout would be similar:

UIView.animate(withDuration: animated ? duration : 0) {
     myView.flex.height(isExpanded ? 100 : 20)
     myView.flex.markDirty() // may not be needed in your case
     // Relayout the flex container embedding your view. See https://github.com/layoutBox/FlexLayout#layout
     myFlexContainer.flex.layout()
}

If you share me your example, I'll be able to check it.

luc

@yashbedi
Copy link
Author

Its working with the solution you gave. I got it. Thanks
you can close the issue =).

@lucdion lucdion closed this as completed Jan 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants