iosipadmultitaskingios9

Detect if app is running in Slide Over or Split View mode in iOS 9


In iOS 9, is it possible to detect when an app is running in iOS 9's Slide Over or Split View mode?

I've tried reading through Apple's documentation on iOS 9 multitasking, but haven't had any luck with this…

I ask because I might have a feature in my app that I'd like to disable when the app is opened in a Slide Over.


Solution

  • Just check if your window occupies the whole screen:

    BOOL isRunningInFullScreen = CGRectEqualToRect([UIApplication sharedApplication].delegate.window.frame, [UIApplication sharedApplication].delegate.window.screen.bounds);
    

    If this is false, then you're running in a split view or a slide over.

    Here is the code snipped which will automatically maintain this flag irrespective of rotation

    -(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
    {
     // simply create a property of 'BOOL' type
     isRunningInFullScreen = CGRectEqualToRect([UIApplication sharedApplication].delegate.window.frame, [UIApplication sharedApplication].delegate.window.screen.bounds);
    }