iOS 9 Split Screen Multitasking: Getting Started (Chinese Version)

iOS 9 Split Screen Multitasking: Getting Started (Chinese Version)

important

This is preliminary documentation for an API or development technology. Apple provides this information primarily to help you plan your use of these technologies or programming interfaces with Apple products. This information may change in the future, and the software mentioned in this article should be tested and finalized with the final release of the operating system. New versions of documentation may be provided in the future.

The multitasking feature in iOS 9 provides us with more ways to enjoy the fun of iPad and App.

  • Slide Over: Allows users to view and interact with secondary apps by bringing up a floating view on the right side of the screen (or the left side of the screen in right-to-left languages).
  • Split View: Presents two side-by-side apps that users can view, resize, and interact with.
  • Picture in Picture function: allows users to float and play videos in multiple applications, and can move and resize video windows.

In the Slide Over feature, the app displayed in full screen is the primary app. The app selected on Slide Over is the secondary app. In the Split View (in a language written from left to right), the app on the left is the primary app, and the app on the right is the secondary app.

All of these new ways to interact with apps, especially multitasking in iOS 9, are very easy and intuitive if you follow Apple’s iOS 8 best practices. Starting with Xcode 7, every iOS App template supports Slide Over and Split View by default.

From a developer's perspective, the biggest challenge is resource management.

Every iOS app (even those that don’t use multitasking) needs to run well in iOS 9. Right now, even full-screen apps don’t efficiently utilize the entire screen, CPU, memory, and other resources. For example, users can:

  • Add a picture-in-picture window to the screen. No matter what is displayed on the screen (including a full-screen app), the app containing the video will continue to run in the background. PiP from other apps will increase the memory pressure of the app and reduce the display frame rate of the app.
  • Slide Slide Over to use the secondary app. When it is visible, the secondary app runs in the foreground, which will increase the memory pressure of the app again and reduce the display frame rate of the app.
  • Bringing up the keyboard from a secondary app via Slide Over will cover part of the primary app. Every iOS 9 developer, even one who develops a full-screen app and has never used the keyboard, may want to respond to notifications of the keyboard appearing as described in UIWindow Class Reference.

In order to effectively participate in this environment, iOS9 developers must carefully adjust their app's resource consumption. If an app consumes too much time per frame, the screen refresh rate will drop below 60 frames per second. Under memory pressure, the system will terminate the app that consumes the most memory.

To learn more about how to manage resources in iOS 9, see Multitasking Mindset.

Understand the features of the app and review your work

Consider the characteristics of your app and decide which multitasking enhancements you want to implement and what work needs to be done.

Most apps should use Slide Over and Split View. From a user's perspective, an iOS 9 app that doesn't support these two features is a bit out of place.

If your app meets any of the following conditions, you may not support multitasking:

  • A camera-centric app that uses the entire screen for preview and quickly captures the moment as its main function.
  • Apps that use the full device screen, such as games that use the iPad's sensors as part of the core game controls.

Beyond that, Apple and your users expect you to use Slide Over and Split View. For more information, see Slide Over & Split View Quick Start.

If you don’t use Slide Over and Split View, add the UIRequiresFullScreen key to the Xcode project’s Info.plist file and set its Boolean value to YES.

Note: Not using Slide Over and Split View means your app cannot appear in the Slide Over area, even though your app is running in a multitasking environment. Test your app on the hardware you want to support to make sure your app runs smoothly when other apps appear in Slide Over mode and in picture-in-picture mode playing a video from a third app.

Picture-in-Picture (PiP) is suitable for apps whose main function is to play videos. Picture-in-Picture (PiP) is also best suited for medium- to long-term content playback.

Support for Picture in Picture allows your users to interact with your app or other apps while the video is playing. To learn and use PiP, please read Picture in Picture Quick Start.

Game scene transitions, first launch, and similar content should not support PiP. You can choose to exit PiP for a given video as follows:

  • For the AVPlayerViewController class, set the allowsPictureInPicturePlayback property to NO.
  • For the AVPlayerLayer class, do not instantiate an AVPictureInPictureController object with your playback layer object.
  • For the WKWebView class, set its allowsPictureInPictureMediaPlayback property to NO (this property will only be available in future iOS 9 beta versions).

Note: If your app uses the Media Player framework to play videos, whether using the MPMoviePlayerController or MPMoviePlayerViewController class in its framework, you must migrate to using AVKit or AV Foundation. Media Player video playback is officially deprecated in iOS 9.

If your app plays HTTP Live Streaming (HLS) video, use metadata to optimize playback. Optimize your app's performance across various video window sizes by responding to the stream-variant metadata tag. To minimize battery drain, the content delivery networks (CDNs) you use should also provide multiple stream variants and annotate each variant with the appropriate resolution tag. For more information, see HTTP Live Streaming Overview.

If your app displays content on a second physical screen, test your app’s transitions.

In particular, you need to test the use case of transitioning from a secondary app to a primary app. Only the primary app is eligible to use the second physical screen, so transitioning to the primary app is a new scenario in which your app can receive the UIScreenDidConnectNotification notification. Make sure your app helps the user understand what is happening in the use case, which may be a bit strange when the content moves to the second screen.

Development Environment

Xcode7 supports multitasking enhancements on iPad.

Use new features in Xcode 7, Simulator, and Instruments:

  • Pre-configured support for Slide Over and Split View is included in each iOS App template. For example, it includes a LaunchScreen.storyboard file and a pre-set Info.plist file. See: Xcode Overview
  • Storyboards in Interface Builder make it easy to implement Auto Layout constraints. See Auto Layout Guide and Auto Layout Help for more information.
  • Interface Builder Preview Assistant lets you instantly see how your layout will adapt to different size classes in Slide Over and Split View scenarios. See Size Classes Design Help and Previewing Your Layout for Different Localizations, iOS Devices, and iOS Versions.
  • The simulator in Xcode 7 lets you use the same gestures to bring up Slide Over and Split View as you would on a real device. You can use the simulator to test the behavior of all Slide Over and Split View layouts, as well as test picture-in-picture. However, the simulator cannot simulate the memory, CPU, GPU, disk I/O, or other resource characteristics of a real iOS device. For guidelines on using the simulator, see the Simulator User Guide.
  • The memory allocation, Time Profiler, and Leaks profiling templates in Instrument allow you to monitor the behavior and resource usage of your app. For details, see: Instruments User Guide? and Instruments Help.
  • Xcode7 provides a visual interface for full support of asset catalogs. Use asset catalogs for your visual assets, such as images and app icons. This is very important for optimizing your app's memory. See Asset Catalog Help. You can also use asset catalogs programmatically, see UIImageAsset Class Reference?.

To test memory, CPU, GPU, and all hardware-related performance, test your app on the hardware you want to support. To test your app on iOS devices, you must be a member of the iOS Developer Program. See Managing Accounts in the App Distribution Guide.

In iOS 9, the following iPad models support multitasking enhancements.

Multitasking mindset

To be successful on iPads powered by iOS 9, your app must perform well with device resources, both against the system and against other apps on the device.

When your app is running in the foreground, other apps may be running alongside it, or a picture-in-picture video may be playing while the app holding it is running in the background.

Before iOS 9, you could use any available CPU, GPU, memory, I/O, and hardware resources to maintain a great experience. In iOS 9, all of this will change. It becomes critical for apps to use resources efficiently so that the user's iPad experience is smooth and responsive.

To provide the best user experience, the system closely manages resource consumption and terminates apps that use more than the system quota.

Most of the work you do on your iPad using multitasking enhancements will likely be best practices for resource management.

  • Use Instrument to test your app to ensure it has no memory leaks, does not grow infinitely, or blocks the main thread.
  • Use the app state transition protocol methods to discard unnecessary view controllers, views, resources, and data caches when your app moves to the background.
  • Test your app on each supported device, using a resource-intensive app such as a map app that sets up a satellite view and performs flyover image animations. Test your app as both the primary and secondary app to ensure that both your app and the map app are responsive in both cases.

In iOS 9, it is no longer appropriate to think in terms of the screen’s interface orientation. Apps can adapt to either the compact Size Class or the regular Size Class in a horizontal orientation on iPad, and resize independently of the interface orientation. Instead, use trait collections and Size Classes, using the UIContentContainer and UITraitEnvironment protocols, as described in Slide Over and Split View Quick Start.

Also in iOS 9 it is no longer appropriate to use the screen's bounds to determine the visible area of ​​your app, but rather the bounds of your app's window. Note that your app's bounds should be controllable. You cannot set the bounds of your app's bounds, nor can you prevent them from changing.

Although Auto Layout is not required to build an optimal iOS 9 app, it makes it easier to do so. Auto Layout provides performance benefits and helps you match the best practices described by Apple in the iOS Human Interface Guidelines. In short, Auto Layout helps your content appear in the right place and facilitates future iterations of your app. You can use Auto Layout over and over again, one layout at a time. At a minimum, your LaunchScreen.storyboard file must use Auto Layout. Throughout your app, use Storyboards to help your views adapt to the changing size of your views as users open and use your app in different situations.

<<:  APP UI design trends: moving for good design

>>:  6 key points for social operation of mobile games

Recommend

Case analysis: How to use Internet thinking for online promotion?

With the high penetration of the Internet, the le...

Want to do a "screen-sweeping" marketing? Understand user psychology first!

There is perhaps no industry in the world that is...

How much does it cost to customize a catering mini program in Hezhou?

How much does it cost to customize a catering min...

5 tips for shooting short videos!

Do you feel like I always shoot videos that are n...

9 key points for event planning!

In marketing operations, marketing activities, as...

pua popular explanation, what is PUA?

pua popular explanation, what is PUA? PUA origina...

Android interception AMS request practice

Overview Following the last requirement of starti...

Taihang Mountains are so beautiful!

Tai means big Walker, shape Taihang Mountains It ...