This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
iOS 9 supports two apps running at the same time, using slide over or split view. It also supports video playing Picture-In-Picture.


iOS 9 adds multitasking support for running two apps at the same time on specific iPad hardware. Multitasking for iPad is supported via the following features:
There are a number of things to consider whensupporting multitasking in your app, including:
As an app developer you can alsoopt out of multitasking, includingdisabling PIP Video Playback.
This article will cover the steps required to ensure that your Xamarin.iOS app runs correctly in a multitasking environment or how to opt out of multitasking if it is not a good fit for your app.
Multitasking for iPad video
To supportSlide Over orSplit View your app must do the following:
iOS 9 offers new multitasking abilities on iPad with the introduction ofSlide Over,Split View (iPad Air 2, iPad Mini 4 and iPad Pro only) andPicture in Picture. We'll take a closer look at these features in the following sections.
The Slide Over feature allows the user to pick a second app and display it in a small sliding panel to provide quick interaction. The Slide Over panel is temporary, and will close when the user goes back to working with the main app again.
The main thing to remember is that the user decides which two apps will be running side-by-side and that the developer has no control over this process. As a result, there are a few things that you will need to do to ensure your Xamarin.iOS app runs correctly in a Slide Over panel:
Slide Over is available only on an iPad Pro, iPad Air, iPad Air 2, iPad Mini 2, iPad Mini 3, or iPad Mini 4. To learn more about preparing your app for Slide Over, please see Apple'sAdopting Multitasking Enhancements on iPad documentation.
On supported iPad hardware (iPad Air 2, iPad Mini 4 and iPad Pro only), the user can pick a second app and run it side-by-side with the currently running app in a split screen mode. The user can control the percentage of the main screen that each app occupies by dragging an on-screen divider.
Like Slide Over, the user decides which two apps will be running side-by-side and again, the developer has no control over this process. As a result, Split View places similar requirements on a Xamarin.iOS app:
To learn more about preparing your app for Split View, please see Apple'sAdopting Multitasking Enhancements on iPad documentation.
The new Picture in Picture feature (also known asPIP) allows the user to watch a video in a small, floating window that the user can position anywhere on screen above other running apps.
As with Slide Over and Split View, the user has full control over watching a video in the Picture in Picture mode. If your app's main function is to watch video, it will need some modification to behave correctly in PIP mode. Otherwise, no changes are required to support PIP.
For your app to display PIP video at the user's request, you will need to be using eitherAVKit or theAV Foundation APIs. The Media Player framework has been depreciated in iOS 9 and does not support PIP.
Picture in Picture is available only on an iPad Pro, iPad Air, iPad Air 2, iPad Mini 2, iPad Mini 3, or iPad Mini 4. For more information, see Apple'sPicture in Picture Quick Start documentation.
For any existing Xamarin.iOS app, supporting multitasking is a transparent task as long as your app already follows Apple's design guides and best practices for iOS 8. This means that the app should be using storyboards with Autolayout and Size Classes for its User Interface layouts (see ourIntroduction to Unified Storyboards for more information).
For these apps, little or no changes are required to support multitasking and to behave well within it. If your app's UI, was created using other methods such as directly positioning and sizing UI elements in C# code or if it relies on specific device screen sizes or orientations, it will need significant modification to support iOS 9 multitasking correctly.
To support iOS 9 multitasking on any new Xamarin.iOS app, again use storyboards with Autolayout and Size Classes for all of the app's User Interface layouts and implement the instructions in the following sections.
Before iOS 9, you could design your app against specific device screen sizes and orientations. Because an app can now be run in a Slide Out panel or in Split View mode, it can find itself running in either a compact or regular horizontal size class on iPad, regardless of the device's physical orientation or screen size.
On an iPad, a full screen app has Regular horizontal and vertical Size Classes. All iPhones but the iPhone 6 Plus and iPhone 6s Plus, have Compact Size classes in both directions in any orientation. The iPhone 6 Plus and iPhone 6s Plus in Landscape mode have a Regular horizontal Size Class and a Compact vertical Size Class (much like an iPad Mini).
On iPads that support Slide Over and Split View, you can end up with the following combinations:
| Orientation | Primary App | Secondary App |
|---|---|---|
| Portrait | 75% of Screen Compact Horizontal Regular Vertical | 25% of Screen Compact Horizontal Regular Vertical |
| Landscape | 75% of Screen Regular Horizontal Regular Vertical | 25% of Screen Compact Horizontal Regular Vertical |
| Landscape | 50% of Screen Compact Horizontal Regular Vertical | 50% of Screen Compact Horizontal Regular Vertical |
In the sample app, if it is run full screen on an iPad in the landscape mode, it will present both the list and the detail view at the same time:
If the same app is run in a Slide Over panel, it is laid out as a Compact Horizontal Size Class and displays only the list:
To ensure that your app behaves correctly in these situations, you should adopt Trait Collections along with Size Classes and conform to theIUIContentContainer andIUITraitEnvironment interfaces. See Apple'sUITraitCollection Class Reference and ourIntroduction to Unified Storyboards guide for more information.
Additionally, you can no longer rely on the devices screen bounds to define the app's visible area, you'll need to use your app's window bounds instead. Since the window bounds are fully under the control of the user, you cannot programmatically adjust them or prevent the user from changing these bounds.
Finally, your app must use a storyboard file to present its Launch Screen as opposed to using a set of.png image files and support all four interface orientations (Portrait, Upside-down Portrait, Landscape Left and Landscape Right) to be considered for running in a Slide Over panel or in Split View mode.
In iOS 9 running on an iPad, Apple has extended support for hardware keyboards. iPads have always included basic external keyboard support via Bluetooth and some keyboard manufacturers created keyboards that included hard-wired iOS-specific keys.
Now, with iOS 9, apps can create their own custom keyboard shortcuts. Additionally, some basic keyboard shortcuts are available likeCommand-C (copy),Command-X (cut),Command-V (paste) andCommand-Shift-H (home), without an app being specifically written respond to them.
Command-Tab will bring up an app switcher that allows the user to quickly switch between apps from the keyboard, much like the Mac OS:
If an iOS 9 app includes keyboard shortcuts, the user can hold down on theCommand,Option orControl keys to display them in a popup:
If we add the following code to a View or View Controller in our app, when that view or controller is visible, a custom keyboard shortcut will be available:
#region Custom Keyboard Shortcutpublic override bool CanBecomeFirstResponder { get { return true; }}public override UIKeyCommand[] KeyCommands { get { var keyCommand = UIKeyCommand.Create (new NSString("n"), UIKeyModifierFlags.Command, new Selector ("NewEntry"), new NSString("New Entry")); return new UIKeyCommand[]{ keyCommand }; }}[Export("NewEntry")]public void NewEntry() { // Add a new entry ...}#endregionFirst, we override theCanBecomeFirstResponder property and returntrue so the View or View Controller can receive keyboard input.
Next, we override theKeyCommands property and create a newUIKeyCommand for theCommand-N keystroke. When the keystroke is activated, we call theNewEntry method (that we expose to iOS 9 using theExport command) to perform the requested action.
If we run this app on an iPad with an hardware keyboard attached and the user typesCommand-N, a new entry will be added to the list. If the user holds down on theCommand key, the list of shortcuts will be displayed:
Even for apps that are already using iOS 8's design guides and best practices, efficient resource management might still be an issue. In iOS 9, apps no longer have exclusive use of memory, CPU or other system resources.
As a result, you must fine-tune your Xamarin.iOS app to use system resources effectively or it faces termination under low memory situations. This is equally true of apps that opt out of multitasking, since a second app might still be run in a Slide Over panel or a Picture in Picture window requiring extra resources or causing the refresh rate to fall below 60 frames per second.
Consider the following user actions and their implications:
To ensure that your app is using resources efficiently, you should do the following:
See Apple'sEnergy Efficiency Guide for iOS Apps for more information on resource management.
While Apple suggests that all iOS 9 apps support multitasking, there might very specific reasons for an app not too, such as games or camera apps that require the full screen to work correctly.
For your Xamarin.iOS app to opt out of being run in either a Slide Out panel or in Split View mode, edit the project'sInfo.plist file and checkRequires Full Screen:
Important
While opting out of multitasking prevents your app from being run in SlideOut or Split View, it does not prevent another app from being run in SlideOut or a Picture in Picture video from displaying along with your app.
In most situations, your app should allow the user to play any video content it displays in a Picture in Picture floating window. However, there might be situations where this might not be desired, such as game cut scene videos.
To opt out of PIP video playback, do the following in your app:
AVPlayerViewController to display video, set theAllowsPictureInPicturePlayback property tofalse.AVPlayerLayer to display video, don't instantiate anAVPictureInPictureController.WKWebView to display video, set theAllowsPictureInPictureMediaPlayback property tofalse.This article has covered the steps required to ensure that a Xamarin.iOS app will run and behave correctly in iOS 9's new multitasking ability for iPads. In addition, it covered opting-out of multitasking for apps where it is not a good fit.