対話を持つビューのサブビューを無効にすることができます。私はそれらのサブビューに注意し、その後、それらのサブビューをアクティブにするだけです。
スイフト2:
var disabledSubviews = [UIView]()
let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: { (action) in
for subview in disabledSubviews {
subview.userInteractionEnabled = true
}
}))
self.presentViewController(alert, animated: true) {
for subview in self.view.subviews {
if subview.userInteractionEnabled == true {
disabledSubviews.append(subview)
subview.userInteractionEnabled = false
}
}
}
スウィフト3:
var disabledSubviews = [UIView]()
let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action) in
for subview in disabledSubviews {
subview.isUserInteractionEnabled = true
}
}))
self.present(alert, animated: true) {
for subview in self.view.subviews {
if subview.isUserInteractionEnabled == true {
disabledSubviews.append(subview)
subview.isUserInteractionEnabled = false
}
}
}