scenee / FloatingPanel

A clean and easy-to-use floating panel UI component for iOS
MIT License
5.61k stars 510 forks source link

There is an extra safe area scroll for table view #606

Closed Zeynal7 closed 1 year ago

Zeynal7 commented 1 year ago

Description

When I try to scroll the table view, it has extra scroll at the bottom. I checked its height and it is 34 pixel which matches safe area.

I have tried the following, but none of them worked

tableView.insetsContentViewsToSafeArea = false
tableView.contentInsetAdjustmentBehavior = .never
set header and footer height to 0

Expected behavior

Scroll should stop when end of content is reached

Actual behavior

Scroll continues for extra 34 pixels.

Steps to reproduce

Code example that reproduces the issue

I have updated one of the samples - AdaptiveLayoutTestViewController - https://github.com/Zeynal7/FloatingPanelDemo

https://github.com/scenee/FloatingPanel/assets/35888362/51f82102-a851-4f5e-a8cd-045cd25ecd52

Environment

Library version

Installation method

Version 2.7.0 with SPM

iOS version(s)

Tested on 16.4 and 17.0 Only reproducible with devices that have safe area

Xcode version

14.3

scenee commented 1 year ago

This issue can be resolved by applying this patch.

diff --git a/Examples/Samples/Sources/UseCases/UseCaseController.swift b/Examples/Samples/Sources/UseCases/UseCaseController.swift
index a8fd6f6..62f39a6 100644
--- a/Examples/Samples/Sources/UseCases/UseCaseController.swift
+++ b/Examples/Samples/Sources/UseCases/UseCaseController.swift
@@ -248,7 +248,7 @@ extension UseCaseController {
         case .showAdaptivePanelWithCustomGuide:
             let fpc = FloatingPanelController()
             fpc.isRemovalInteractionEnabled = true
-            fpc.contentInsetAdjustmentBehavior = .always
+            fpc.contentInsetAdjustmentBehavior = .never
             fpc.surfaceView.appearance = {
                 let appearance = SurfaceAppearance()
                 appearance.cornerRadius = 6.0

This is because FloatingPanelController automatically sets a content inset as its safe area if fpc.contentInsetAdjustmentBehavior is set to .always :)

Zeynal7 commented 1 year ago

I see. Thank you.