Bladeren bron

Fix NCMenu height when rotating

Use only as much height as needed. Fewer actions -> smaller menu -> bigger insert

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 jaren geleden
bovenliggende
commit
ff1561ab97
1 gewijzigde bestanden met toevoegingen van 5 en 4 verwijderingen
  1. 5 4
      iOSClient/Menu/NCMenu.swift

+ 5 - 4
iOSClient/Menu/NCMenu.swift

@@ -102,11 +102,11 @@ class NCMenu: UITableViewController {
 extension NCMenu: FloatingPanelControllerDelegate {
 
     func floatingPanel(_ fpc: FloatingPanelController, layoutFor size: CGSize) -> FloatingPanelLayout {
-        return NCMenuFloatingPanelLayout(numberOfActions: self.actions.count, view: view)
+        return NCMenuFloatingPanelLayout(numberOfActions: self.actions.count)
     }
 
     func floatingPanel(_ fpc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout {
-        return NCMenuFloatingPanelLayout(numberOfActions: self.actions.count, view: view)
+        return NCMenuFloatingPanelLayout(numberOfActions: self.actions.count)
     }
 
     func floatingPanel(_ fpc: FloatingPanelController, animatorForDismissingWith velocity: CGVector) -> UIViewPropertyAnimator {
@@ -138,10 +138,11 @@ class NCMenuFloatingPanelLayout: FloatingPanelLayout {
 
     let topInset: CGFloat
 
-    init(numberOfActions: Int, view: UIView) {
+    init(numberOfActions: Int) {
         let bottomInset = UIApplication.shared.keyWindow?.rootViewController?.view.safeAreaInsets.bottom ?? 0
+        let screenHeight = UIScreen.main.bounds.size.height
         let panelHeight = CGFloat(numberOfActions * 60) + bottomInset
-        topInset = max(48, view.bounds.height - panelHeight)
+        topInset = max(48, screenHeight - panelHeight)
     }
 
     func prepareLayout(surfaceView: UIView, in view: UIView) -> [NSLayoutConstraint] {