FittedSheets icon indicating copy to clipboard operation
FittedSheets copied to clipboard

How to display sheet after hiding

Open CripyIce opened this issue 5 years ago • 4 comments

Hi there, I'm displaying a SheetViewController using inline method, and after calling sheetController?.animateOut() the method sheetController?.animateIn() does nothing. I could only redisplay the SheetViewController after calling all this code again:

sheetController.willMove(toParent: self)
self.addChild(sheetController)
view.addSubview(sheetController.view)
sheetController.didMove(toParent: self)

sheetController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
    sheetController.view.topAnchor.constraint(equalTo: view.topAnchor),
    sheetController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
    sheetController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
    sheetController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor)
])

// animate in
sheetController.animateIn()

Am I using this library the wrong way? Or is it how it's supposed to be? Thanks!

CripyIce avatar Dec 02 '20 11:12 CripyIce

Facing the same issue.

danishnisar avatar Dec 05 '20 11:12 danishnisar

This should be fixed in 2.3.0

gordontucker avatar Jan 04 '21 18:01 gordontucker

@gordontucker This is still happens...

CripyIce avatar Jan 06 '21 21:01 CripyIce

I added another update that might help you out. The call to animate in should change from this:

self.addChild(sheetController)
view.addSubview(sheetController.view)
sheetController.didMove(toParent: self)

sheetController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
    sheetController.view.topAnchor.constraint(equalTo: view.topAnchor),
    sheetController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
    sheetController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
    sheetController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor)
])

// animate in
sheetController.animateIn()

to this:

sheetController.animateIn(to: view, in: self)

Once you switch to use that and have 2.3.2, it should fix the problem you are having. Thanks for being patient and not being complaining about a free tool not being good enough. I appreciate your patiences everyone.

gordontucker avatar Jan 22 '21 22:01 gordontucker