PullUpController icon indicating copy to clipboard operation
PullUpController copied to clipboard

Bottom elements don't move when closing

Open heltisace opened this issue 5 years ago • 6 comments

If you add some component in the bottom with constraints not being set to top (for example bottom, sides and constant size) you will get this.

heltisace avatar Dec 13 '18 14:12 heltisace

Temporarily fixed by removing bottom constraints. UPD: I mean bottom constraints in your lib. UPD2: Doesn't fully solve the problem, because now transition animation can't get where elements must be.

heltisace avatar Dec 13 '18 14:12 heltisace

I saw the video and I don't really understand what's going on. I guess your main view has a blue background and your popup view controller's view is white and then you've added another view (the yellow one) on top of everything, is that right? What's the problem?

MarioIannotta avatar Dec 14 '18 18:12 MarioIannotta

Not quite. The yellow view is inside PullUpController and, obviously, it shouldn't behave as it does. Here is this project. Please, take a look. Drawers.zip

heltisace avatar Dec 14 '18 18:12 heltisace

Ok, I've found a solution. The problem was the pull up controller's view bottom anchor is equal to the parent view bottom anchor and to match this constraint, when the view is dragged down (aka the top constraint's constant is increased), it shrinks.

Instead of bottomConstraint = parentView.bottomAnchor.constraint(equalTo: view.bottomAnchor) we could use bottomConstraint = parentView.bottomAnchor.constraint(lessThanOrEqualTo: view.bottomAnchor)

I need to check if this change causes some regression, if not, I'll commit the change.

MarioIannotta avatar Dec 14 '18 19:12 MarioIannotta

@MarioIannotta I found a bug with this solution. Now animation causes PullUp to jump from the bottom and show some free space there. We've already experienced this problem before, if you remember.

UPD: This is second video on here: https://github.com/MarioIannotta/PullUpController/issues/33#issuecomment-433612645

heltisace avatar Dec 17 '18 21:12 heltisace

@MarioIannotta the question is why do you use 3 constraints to specify a vertical position on the screen while 2 of them is enough - bottom and height for example?

Gargo avatar Mar 06 '23 06:03 Gargo