sberrevoets / SDCAlertView

The little alert that could
MIT License
1.86k stars 298 forks source link

override var supportedInterfaceOrientations: UIInterfaceOrientationMask #328

Open babynonkeyxs opened 2 years ago

babynonkeyxs commented 2 years ago

if my baseNavigationController overwrite like this :

public override var supportedInterfaceOrientations: UIInterfaceOrientationMask { return self.visibleViewController?.supportedInterfaceOrientations ?? .portrait }

and your AlertController overwrite like this :

public override var supportedInterfaceOrientations: UIInterfaceOrientationMask { return self.presentingViewController?.supportedInterfaceOrientations ?? super.supportedInterfaceOrientations }

then visibleViewController of baseNavigationController isqual to SDCAlertController and presentingViewController of AlertController isqual to baseNavigationController circular reference

sberrevoets commented 2 years ago

I wouldn't use visibleViewController to determine the supported orientations, but rather topViewController. If that doesn't work, you'll have to check the class of visibleViewController first or keep a reference to the alert around and check that visibleViewController != alert.