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

How to change height of sheet after updated content size of view? #123

Closed
khushabu29 opened this issue Dec 8, 2020 · 5 comments · Fixed by #153
Closed

How to change height of sheet after updated content size of view? #123

khushabu29 opened this issue Dec 8, 2020 · 5 comments · Fixed by #153

Comments

@khushabu29
Copy link

khushabu29 commented Dec 8, 2020

If the content size of the view controller's view gets changed while the sheet is opened for any reason for example label text gets updated to 3 lines from 1 line, then the sheet height does not get resized (does not increase or decrease the height of the sheet). In fact, some content gets shrink as shown in the screenshot.

IMG_6CCB7D3C221E-1

@khushabu29 khushabu29 changed the title Height does not change according to content once the sheet appears How to change height of sheet after updated content size of view? Jan 6, 2021
@ArlindDushi
Copy link

Hey @gordontucker
Thanks for the amazing library. I also have a case in my app where content gets resized after the viewcontroller is already presented, so can this be achieved with the current version or does it need extra implementation?

@jerometonnelier
Copy link

Same issue here with some dynamic content. It's an awesome library btw ;-)
@ArlindDushi @khushabu29 did you manage to update the size of the presented controller? I tried to invalidate various contentSizes, but no luck so far either. I use on [.intrinsic] as options.
Thanks

@BradPatras
Copy link
Contributor

Ran into this same issue when updating the sheet content after initial view load. The function that does the trick is in SheetContentViewController.swift. The function updatePreferredHeight() will recalculate the intrinsic height based on the content. Unfortunately this function is not public so it's inaccessible.

One way to call that method indirectly is to call sheetViewController.animateIn() when the content/height changes. This method technically does quite a few things in addition to recalculating the height but in my case it turned out to be exactly what I needed!

BradPatras added a commit to BradPatras/FittedSheets that referenced this issue Aug 4, 2021
… a public func, 'updateIntrinsicHeight()' to recalculate/update the intrinsic height of the sheet. Resolves gordontucker#123
BradPatras added a commit to BradPatras/FittedSheets that referenced this issue Aug 4, 2021
… a public func, 'updateIntrinsicHeight()' to recalculate/update the intrinsic height of the sheet. Resolves gordontucker#123
@jerometonnelier
Copy link

Thanks a lot @gordontucker ;-)

@ankitagarwal007
Copy link

@gordontucker It is not working if scrollview is present

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

Successfully merging a pull request may close this issue.

5 participants