Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 762
Matias Korhonen Avatar asked Jul 12 '15 11:07

Matias Korhonen


People also ask

Is slide over and split view on all ipads?

Split View allows you to display two apps on the screen in their own resizable panes. You can then add a third app, which resides in the floating pane. Both Slide Over and Split View are supported by the iPad Pro, the 5th generation iPad and later, the iPad Air 2 and later, and the iPad mini 4 and later.

Can iOS use split screen?

Unfortunately, you can't split your iPhone's screen to use multiple apps at once, at least not in the way you're probably hoping. However, you can use features like picture-in-picture and fast app switching to multitask. We'll show you how to access these options on your phone.


1 Answers

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); } 
like image 139
Tamás Zahola Avatar answered Sep 18 '22 17:09

Tamás Zahola