Closed codwam closed 7 years ago
I would suggest to take UIWindow from "fromView" parameter in
open func show(_ contentView: UIView, fromView: UIView, inView: UIView) {
if let window = fromView.window{
// show popover
}
}
I experienced an issue when UIKeyboard animation just completed but keyboard window was still both "key" and "last" window of the UIApplication. In such case popover will be added to keyboard window and will not be visible.
The below code repeat 3 times:
guard let rootView = UIApplication.shared.windows.last ?? UIApplication.shared.keyWindow else {</br> return }
Make a constant
or let
declear it may be better?
And the fromView
in parameters should have a default value I think.
Close Any Time.
Also fixed in #80 @corin8823
open func show(_ contentView: UIView, point: CGPoint) { // guard let rootView = UIApplication.shared.windows.last ?? UIApplication.shared.keyWindow else { // return // } // This works good guard let rootView = UIApplication.shared.keyWindow ?? UIApplication.shared.windows.last else { return } self.show(contentView, point: point, inView: rootView) }
In iOS11:
UIApplication.shared.keyWindow ?? UIApplication.shared.windows.last
is_UIInteractiveHighlightEffectWindow
?