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

Use case: make positions depend on size of content of sheet #40

Open
GerdC opened this issue Aug 9, 2020 · 0 comments
Open

Use case: make positions depend on size of content of sheet #40

GerdC opened this issue Aug 9, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@GerdC
Copy link

GerdC commented Aug 9, 2020

I'd like to have positions of the sheet depend on the size of the content of the sheet.

There were some tweaks necessary, but it works for me now.

One problem I had to fix is this:
UBottomSheetCoordinator sets its private variables minSheetPosition and maxSheetPosition very early in the process, when it is impossible that the sheet had any chance to do a layout. So the height of the content of the sheet is 0 at this point of time.

my workaround is this:

    self.sheetCoordinator.addSheet(transitPlanViewController, to: self, didContainerCreate: { container in
        let f = self.view.frame
        let rect = CGRect(x: f.minX, y: f.minY, width: f.width, height: f.height)
        container.roundCorners(corners: [.topLeft, .topRight], radius: 10, rect: rect)
        self.sheetCoordinator.dataSource = dataSource // side effect: calculates private vars minSheetPosition + maxShetPosition from size of sheet after layout
    })

You might decide to do something similar in the library.
Maybe even a public method to recalculate minSheetPosition and maxSheetPosition after rotating the device.

@GerdC GerdC changed the title Use case: make positions depnd on size of content of sheet Use case: make positions depend on size of content of sheet Aug 9, 2020
@OfTheWolf OfTheWolf added the enhancement New feature or request label Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants