@@ -59,14 +59,15 @@ extension UIViewController {
5959 public func presentSemiView( _ view: UIView , options: [ SemiModalOption : Any ] ? = nil , completion: ( ( ) -> Void ) ? = nil ) {
6060 registerOptions ( options)
6161 let targetView = parentTargetView ( )
62-
62+ let targetParentVC = parentTargetViewController ( )
63+
6364 if targetView. subviews. contains ( view) {
6465 return
6566 }
6667
6768 objc_setAssociatedObject ( view, & semiModalPresentingViewController, self , . OBJC_ASSOCIATION_RETAIN_NONATOMIC)
6869
69- NotificationCenter . default. addObserver ( self ,
70+ NotificationCenter . default. addObserver ( targetParentVC ,
7071 selector: #selector( interfaceOrientationDidChange ( _: ) ) ,
7172 name: . UIDeviceOrientationDidChange,
7273 object: nil )
@@ -169,7 +170,9 @@ extension UIViewController {
169170
170171 @objc func interfaceOrientationDidChange( _ notification: Notification ) {
171172 guard let overlay = parentTargetView ( ) . viewWithTag ( semiModalOverlayTag) else { return }
172- addOrUpdateParentScreenshotInView ( overlay)
173+ let view = addOrUpdateParentScreenshotInView ( overlay)
174+ view. alpha = CGFloat ( self . optionForKey ( . parentAlpha) as! Double )
175+
173176 }
174177
175178 @objc public func dismissSemiModalView( ) {
@@ -215,7 +218,7 @@ extension UIViewController {
215218 objc_setAssociatedObject ( targetVC, & semiModalDismissBlock, nil , . OBJC_ASSOCIATION_COPY_NONATOMIC)
216219 objc_setAssociatedObject ( targetVC, & semiModalViewController, nil , . OBJC_ASSOCIATION_RETAIN_NONATOMIC)
217220
218- NotificationCenter . default. removeObserver ( self , name: . UIDeviceOrientationDidChange, object: nil )
221+ NotificationCenter . default. removeObserver ( targetVC , name: . UIDeviceOrientationDidChange, object: nil )
219222 } )
220223
221224 if let screenshot = overlay. subviews. first {
0 commit comments