NCMenuPanelController.swift 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // NCMenuPanelController.swift
  3. // Nextcloud
  4. //
  5. // Created by Philippe Weidmann on 23.01.20.
  6. // Copyright © 2020 Philippe Weidmann. All rights reserved.
  7. // Copyright © 2020 Marino Faggiana All rights reserved.
  8. //
  9. // Author Philippe Weidmann
  10. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  11. //
  12. // This program is free software: you can redistribute it and/or modify
  13. // it under the terms of the GNU General Public License as published by
  14. // the Free Software Foundation, either version 3 of the License, or
  15. // (at your option) any later version.
  16. //
  17. // This program is distributed in the hope that it will be useful,
  18. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. // GNU General Public License for more details.
  21. //
  22. // You should have received a copy of the GNU General Public License
  23. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. //
  25. import FloatingPanel
  26. class NCMenuPanelController: FloatingPanelController {
  27. var panelWidth: Int? = 0
  28. override func viewDidLoad() {
  29. super.viewDidLoad()
  30. self.surfaceView.grabberHandle.isHidden = true
  31. self.isRemovalInteractionEnabled = true
  32. if #available(iOS 11, *) {
  33. self.surfaceView.cornerRadius = 16
  34. } else {
  35. self.surfaceView.cornerRadius = 0
  36. }
  37. }
  38. override func viewWillLayoutSubviews() {
  39. super.viewWillLayoutSubviews()
  40. if let width = panelWidth {
  41. self.view.frame = CGRect(x: 0, y: 0, width: width, height: Int(self.view.frame.height))
  42. }
  43. }
  44. }