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

uirequiresfullscreen
support split screen ios
xcode 11 split view
ios split screen
ios enable multitasking
ipad split screen ios 12
implement split screen ipad
swift enable split screen

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.

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);
}

Slide Over and Split View Quick Start, Explains how to create apps that work with Slide Over, Split View, and to get your app up and running with iOS 9 multitasking on eligible iPad models. If you think you've set up everything correctly and find that these  Activating split-view is done by sliding your finger in from the right-edge of the screen, in the same manner as done for slide-over. Once the slide-over panel is visible, tap on the small white

Adopting Multitasking Enhancements on iPad: Getting Oriented, Explains how to create apps that work with Slide Over, Split View, and Multitasking enhancements in iOS 9 give users more ways to enjoy The app that provided the video, if it isn't the primary or secondary app, is running in the background. Consider the characteristics of your app to determine which  We used our simple Camera sample app to analyse the use case. The sample app is available on Github and it's developed as of iOS 9 Beta 5.. From the sample app, it can be clearly seen which system events happen when Slide Over is used, and when Split View is used.

I'm late to the party, but if you want a property that works independent of the orientation, try this one:

extension UIApplication 
{
    func isRunningInFullScreen() -> Bool
    {
        if let w = self.keyWindow
        {
            let maxScreenSize = max(UIScreen.mainScreen().bounds.size.width, UIScreen.mainScreen().bounds.size.height)
            let minScreenSize = min(UIScreen.mainScreen().bounds.size.width, UIScreen.mainScreen().bounds.size.height)
            let maxAppSize = max(w.bounds.size.width, w.bounds.size.height)
            let minAppSize = min(w.bounds.size.width, w.bounds.size.height)
            return maxScreenSize == maxAppSize && minScreenSize == minAppSize
        }

        return true
    }
}

iOS 9 Slide Over and Split View, Enabling an existing app to run in these new Split View or Slide Over report that it does indeed run fine in both slide over and split screen modes. the prerequisites and multi-tasking is not working double check you don't  The multitasking features got updates in iOS 11, one of those was slide over which is demonstrated in the gif below. With these changes it's no longer possible to use the techniques that check frame size from iOS 9 to detect if another app is a "slide over" over my app.

You can watch both -willTransitionToTraitCollection:withTransitionCoordinator: for the size class and viewWillTransitionToSize:withTransitionCoordinator: for the CGSize of your view. Hardcoding in size values isn't recommended though.

iOS 9 Multitasking Tutorial, Questions: 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  Use Slide Over to work on an app that slides in front of any open app, or even over two open apps in Split View. How to use Slide Over: Open an app. Swipe up from the bottom of the screen to open the Dock. On the Dock, touch and hold the second app that you want to open, then drag it to the screen. Use Slide Over in Split View:

I recently had to determine display style of an application based including, not only if it changed to split view or slide-over, but also what portion of the screen was being utilized for the application (full, 1/3, 1/2, 2/3). Adding this to a ViewController subclass was able to solve the issue.

/// Dismisses this ViewController with animation from a modal state.
func dismissFormSheet () {
    dismissViewControllerAnimated(true, completion: nil)
}

private func deviceOrientation () -> UIDeviceOrientation {
    return UIDevice.currentDevice().orientation
}

private func getScreenSize () -> (description:String, size:CGRect) {
    let size = UIScreen.mainScreen().bounds
    let str = "SCREEN SIZE:\nwidth: \(size.width)\nheight: \(size.height)"
    return (str, size)
}

private func getApplicationSize () -> (description:String, size:CGRect) {
    let size = UIApplication.sharedApplication().windows[0].bounds
    let str = "\n\nAPPLICATION SIZE:\nwidth: \(size.width)\nheight: \(size.height)"
    return (str, size)
}


func respondToSizeChange (layoutStyle:LayoutStyle) {
    // Respond accordingly to the change in size.
}

enum LayoutStyle: String {
    case iPadFullscreen         = "iPad Full Screen"
    case iPadHalfScreen         = "iPad 1/2 Screen"
    case iPadTwoThirdScreeen    = "iPad 2/3 Screen"
    case iPadOneThirdScreen     = "iPad 1/3 Screen"
    case iPhoneFullScreen       = "iPhone"
}

private func determineLayout () -> LayoutStyle {
    if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
        return .iPhoneFullScreen
    }
    let screenSize = getScreenSize().size
    let appSize = getApplicationSize().size
    let screenWidth = screenSize.width
    let appWidth = appSize.width
    if screenSize == appSize {
        return .iPadFullscreen
    }

    // Set a range in case there is some mathematical inconsistency or other outside influence that results in the application width being less than exactly 1/3, 1/2 or 2/3.
    let lowRange = screenWidth - 15
    let highRange = screenWidth + 15

    if lowRange / 2 <= appWidth && appWidth <= highRange / 2 {
        return .iPadHalfScreen
    } else if appWidth <= highRange / 3 {
        return .iPadOneThirdScreen
    } else {
        return .iPadTwoThirdScreeen
    }

}

override func traitCollectionDidChange(previousTraitCollection: UITraitCollection?) {
    super.traitCollectionDidChange(previousTraitCollection)
    respondToSizeChange(determineLayout())
}

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  How to turn a Slide Over pane into a Split View pane. Step #1. Simply position the Slide Over window on the left or right side of the screen.. Step #2. Next, you have to pull down on the Slide Over pane’s Edit handle at the top of the screen until the main app pane comes up, leaving a black space.

How to use Slide Over and Split View on the iPad, When you're in Split Screen, Full Screen, or Slide Over mode, slide your of that app, including Split Screen and Slide Over views. If you have any questions about iPad multitasking with iOS 12, drop This is how to check if a used iPhone or iPad was stolen from Apple. On certain iPads, you can also resize Split View panes for a 50-50, 25-75 or 75-25 split in a horizontal orientation; when holding the tablet vertically, you'll only have the 25-75 or 75-25 options. 50-50: Each app takes up the exact same real estate on the iPad.

Facebook app for iPadOS updated with Split View and Slide Over , Toggle dark mode Now the app works with both Split Screen and Slide Over. for when you want to share a post with someone through another app without leaving the You can download Facebook for iOS and iPadOS on the App Store for free. Check out 9to5Mac on YouTube for more Apple news:  Open an app on iPad as usual, for example open Safari, Notes, Pages, Files, etc. Swipe up slightly from the bottom of the screen to access the Dock on iPad. Tap and hold on the other app you want to open into Split View and drag it off the dock onto the currently open app.

Switching Apps in iOS 9, If you don't see the open app you want, flick left or right to find it. with a Lightning connector running iOS 8 or later, so the older iPhone 4s, iPad 2, and iPad 3 can't play. Only apps that support Split Screen mode will work. Enter Split Screen: Bring up an app in Slide Over by sliding your finger left from the right edge of  So the introduction of Split View and Slide Over in 2015's iOS 9 was a boon. The addition of drag and drop in last year's iOS 11 nailed it Unfortunately, not all iPads can handle Split View and

Comments
  • I tried this just now and don't always get the right results. Specifically in this scenario: start app, press home, open Safari, slide from right edge to open split view, select my app. The window.frame still shows as 1024x768 and thus is not treated as being in split view...
  • @cleardemon which part of the application lifecycle are you querying window.frame?
  • I am querying this in my application delegate on activation (so applicationDidBecomeActive:). Do you think this is too early?
  • @cleardemon I've checked it with a test app and in your specific example it indeed calls applicationDidBecomeActive: first with a fullscreen window, then calls viewWillTransitionToSize: with the slideover size on the root viewcontroller, then calls setFrame: on the window with the slideover size. So I would recommend either overriding viewWillTransitionToSize: on the root VC, or the window's setFrame: and react to the sizes passed in appropriately. Note that in other cases the window frame is already set correctly in applicationDidBecomeActive:... Strange.
  • Yup, it is strange! But overriding setFrame: on the UIWindow worked for me. Thanks for the help :)
  • Upvoted but had to spend ages converting this to Obj-c. This is the sort of code that makes me scared for when I am eventually forced to move to Swift.
  • @amergin you could've asked for help: in Objective-C, because there's no issue with optionals, the code is MUCH simpler. The only weird thing is that you have to use the CGRectEqualsRect stuff. So most of this code is just making sure to handle optionals correctly. You could just as easily handle all of this by using ! in Swift and making some real runtime assumptions. Thx!
  • Thanks Dan. I should just put in the time and learn Swift but I've been too busy. It wasn't a criticism of your code that it took me ages, more my lack of ability (and probably an old guy fighting the inevitable as well) 😉
  • Translating code to code is also probably a hard a way to learn. Building something in Swift -- just like you probably did in Objective-C originally -- might be a more sensible way to go.
  • This doesn't work if the keyWindow is a custom window with different size.
  • I don't think this is called with Slide Over because the app views are not resized. At least it wasn't for me with an app built with the iOS 8.4 SDK.
  • This is definitely called on a split view transition in iOS 9.
  • Works great for landscape but not so accurate in portrait I found. Could this answer be improved a little by adding a check if the screen is portrait and, if so, calculate 1/3 or 2/3 depending of if the app is less than or greater than half the screen width?
  • Thanks, but I was hoping that there would be an official API for this that I'd just missed. I guess there isn't…
  • Never use hardcoded width / height values - this won't work on new sized iPads