What about on orientation change? Delegate method isn't called when the orientation changes. If my current view controller has an overlay feels like I should be able to access the frame at anytime...to make sure my content doesn't overlap the overlay? Perhaps something like this?
@interface UIWindowScene (SKOverlay)
@property (nullable,nonatomic,strong,readonly) SKOverlay *presentedOverlay;
@end
@interface SKOverlay (FrameInView)
-(void)overlayFrameConvertedToView:(UIView*)view;
@end
//From my view controller...
-(void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
UIWindowScene *scene = self.view.window.windowScene;
SKOverlay *presentedOverlay = scene.presentedOverlay;
if (presentedOverlay == nil)
{
//No overlay...layout
}
else
{
//overlay is showing...don't place anything inside its rect...
CGRect overlayRect = [presentedOverlay overlayFrameConvertedToView:self.view];
}
}
Why doesn't SKOverlay provide a frame/API to convert its current rect into any arbitrary view in the same window scene? I'm assuming the SKOverlay is being shown in a different UIWindow....showing the SKOverlay doesn't even cause -viewSafeAreaInsetsDidChange to be called. Seems like this object can only be used in the simplest of view controllers.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: