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

Dynamic resizing #650

Open
DolganovAnton13 opened this issue Oct 16, 2024 · 3 comments
Open

Dynamic resizing #650

DolganovAnton13 opened this issue Oct 16, 2024 · 3 comments

Comments

@DolganovAnton13
Copy link

Description

I support dynamic font resizing. And I want the panel to be able to dynamically resize, too.

Expected behavior

When changing the settings (increasing or decreasing the font), the panel changes its size.

Actual behavior

The panel does not change its size.

Steps to reproduce

Show the panel on the screen

Simulator Screenshot - new iPhone 15 - 2024-10-16 at 23 11 12

Minimize the application. Open the settings (Large Text) and change the size.

image

Deploy the application. The size of the content should change, but the panel does not.

image

Code example that reproduces the issue

I tried calling the invalidateLayout and invalidateIntrinsicContentSize methods, but it didn't help

class MyFPC: FloatingPanelController {
  override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    invalidateLayout()
    surfaceView.invalidateIntrinsicContentSize()
  }
}

How do you display panel(s)?

  • Present modally

How many panels do you displays?

  • 1

Environment

Library version

  • 2.8.5

Installation method

  • Swift Package Manager

iOS version(s)

  • 17.0 - 18.0.1

Xcode version

  • 16.0
@scenee
Copy link
Owner

scenee commented Oct 17, 2024

Thank you for your report. I'll take a look later.

@scenee
Copy link
Owner

scenee commented Nov 2, 2024

I recommend to use FloatingPanelAdaptiveLayoutAnchor or FloatingPanelIntrinsicLayoutAnchor. I confirmed they are working perfectly for dynamic resizing.

@SinghSukhreet
Copy link

If you are looking to change the size of panel after change in your content size, in your FloatingPanelLayout use a variable to provide panel height like this: .half: FloatingPanelLayoutAnchor( absoluteInset: kSPviewHeight, edge: .bottom, referenceGuide: .safeArea ),

once the content height is adjusted, set the panel layout once again and move it to the desired state: fpc?.layout = SPSelectionLayout() fpc?.move(to: .half, animated: false)

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

No branches or pull requests

3 participants