Skip to content

Commit e28d19d

Browse files
committed
Fixed layout bug for dialog for iOS 12.
1 parent ff646f1 commit e28d19d

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

Example Apps/iOS Example/Scenes/RootController.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ class RootController: SPTableViewController {
9090
let controller = SPPermissions.dialog(selectedPermissions)
9191
controller.dataSource = self
9292
controller.delegate = self
93-
// controller.allowSwipeDismiss = true
94-
// controller.showCloseButton = true
93+
//controller.bounceAnimationEnabled = false
94+
//controller.allowSwipeDismiss = true
95+
//controller.showCloseButton = true
9596
controller.present(on: self)
9697
case 2:
9798
let controller = SPPermissions.native(selectedPermissions)

SPPermissions.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "SPPermissions"
4-
s.version = "6.8.0"
4+
s.version = "6.8.1"
55
s.summary = "Ask permissions on Swift. Available List, Dialog & Native interface. Can check state permission."
66
s.homepage = "https://github.com/ivanvorobei/SPPermissions"
77
s.source = { :git => "https://github.com/ivanvorobei/SPPermissions.git", :tag => s.version }

Sources/SPPermissions/Interface/Dialog/SPPermissionsDialogController.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,25 @@ public class SPPermissionsDialogController: UIViewController, SPPermissionsContr
113113
NotificationCenter.default.addObserver(self, selector: #selector(self.applicationDidBecomeActive), name: UIApplication.didBecomeActiveNotification, object: nil)
114114
}
115115

116+
public override func viewWillAppear(_ animated: Bool) {
117+
super.viewWillAppear(animated)
118+
119+
/**
120+
Special layout call becouse table hasn't valid content size before appear for early ios 12 and lower.
121+
Happen only if `bounceAnimationEnabled` set to false.
122+
Related issue on github: https://github.com/ivanvorobei/SPPermissions/issues/262
123+
*/
124+
if !bounceAnimationEnabled {
125+
if #available(iOS 13, *) {
126+
// All good for iOS 13+
127+
} else {
128+
DelayService.wait(0.2, closure: {
129+
self.dialogView.layout(in: self.view)
130+
})
131+
}
132+
}
133+
}
134+
116135
@objc func applicationDidBecomeActive() {
117136
dialogView.tableView.reloadData()
118137
}

0 commit comments

Comments
 (0)