change presenting way

This commit is contained in:
Mohannad Bakbouk
2021-02-06 03:26:10 +03:00
parent 413204156b
commit a43228ebde
3 changed files with 18 additions and 7 deletions
+10 -5
View File
@@ -18,11 +18,16 @@ class AlertService {
for action in actions {
alert.addAction(action)
}
if let topVC = UIApplication.getTopMostViewController() {
alert.popoverPresentationController?.sourceView = topVC.view
alert.popoverPresentationController?.sourceRect = CGRect(x: topVC.view.bounds.midX, y: topVC.view.bounds.midY, width: 0, height: 0)
alert.popoverPresentationController?.permittedArrowDirections = []
topVC.present(alert, animated: true, completion: completion)
// if let topVC = UIApplication.getTopMostViewController() {
// alert.popoverPresentationController?.sourceView = topVC.view
// alert.popoverPresentationController?.sourceRect = CGRect(x: topVC.view.bounds.midX, y: topVC.view.bounds.midY, width: 0, height: 0)
// alert.popoverPresentationController?.permittedArrowDirections = []
// topVC.present(alert, animated: true, completion: completion)
// }
if let current = (UIApplication.shared.delegate as? AppDelegate)?.window?.rootViewController {
current.present(alert, animated: true, completion: completion)
}
}
@@ -1,11 +1,11 @@
{
"images" : [
{
"filename" : "camera.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "camera.png",
"idiom" : "universal",
"scale" : "2x"
},
@@ -72,7 +72,13 @@ extension CameraInputBarAccessoryViewDelegate {
return InputBarButtonItem()
.configure {
$0.spacing = .fixed(10)
$0.image = UIImage(named: named)?.withRenderingMode(.alwaysTemplate)
if #available(iOS 13.0, *) {
$0.image = UIImage(systemName: "camera.fill")?.withRenderingMode(.alwaysTemplate)
} else {
$0.image = UIImage(named: named)
}
$0.setSize(CGSize(width: 30, height: 30), animated: false)
}.onSelected {
$0.tintColor = .systemBlue