corin8823 / Popover

Popover is a balloon library like Facebook app. It is written in pure swift.
MIT License
2.1k stars 327 forks source link

iOS11 not show #82

Closed codwam closed 6 years ago

codwam commented 7 years ago

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?

bparol commented 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.

codwam commented 7 years ago

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.

ghost commented 6 years ago

Also fixed in #80 @corin8823