A major change in iOS 9 is the addition of multitasking, which allows users to run multiple apps on the screen at the same time. There are two forms, Slide Over and Split View. Slide Over Viewslide over In this form, users can swipe a narrow area from the right side, in which a list of applications is displayed, and then you can choose to open one and display it in this area. It appears above the program you are running in front of, and there will be no interaction or impact between the two applications. Split Viewsplit To open split view, the user drags the split line (between the two apps) to the left. The user controls the size of the two apps' windows that are vertically separated. When split view is in the current state, there is no concept of foreground and background, and both apps are in the foreground. Currently, splite view is only available on iPad Air 2. Enabling Multitasking in Your AppWhen you create a new project, multitasking is enabled by default. If you want to enable this feature for an old project, you need to set it manually. Here is what you need to do if you are using the iOS 9 SDK: 1. Allow all directions (Portrait, Upside Down, Landscape Left, Landscape Right) 2. Use Storyboards Setting (Opting Out)When you have the above two conditions, multitasking can be allowed when you compile with iOS 9 SDK. If you want to edit this property, specify the value of the key UIRequiredFullscreen in info.plist. Importance of Auto LayoutAuto Layout was first introduced in iOS 6, which allows you to control the layout of the UI by setting constraints instead of position information. Adaptive Layout was introduced in iOS 8, which takes Auto Layout's capabilities to a higher level, allowing you to set different constraints for devices of different sizes. Size classes can determine a relative position based on the size of the app window. You may still have a lot of issues that need to be addressed on iOS 9 due to multitasking. Don’t use UIInterfaceOrientation anymoreIn theory, UIInterfaceOrientation doesn't work in multitasking. If you want to determine the UIInterfaceOrientation for an app in multitasking, you can't be sure whether it is in full screen mode. For example, if your app is in the foreground and in landscape orientation, it will still return UIInterfaceOrientationPortrait even though it is wider than portrait. But sometimes we still need to adjust the user interface according to the direction, what should we do? The answer is to use traitCollection.horizontalSizeClass. It will give you the Size Class information, and you can adjust the layout of the view in the application according to the direction. Size change eventsPreviously, when a rotation event occurred, we recommended using willRotateToInterfaceOrientation and didRotateToInterfaceOrientation methods to respond. In iOS 8, Apple introduced willTransitionToTraitCollection and viewWillTransitionToSize. These methods are still valid for multitasking in iOS 9, and are even more important. You can detect the direction and manually compare the width and height according to your needs. Keyboard response eventsPreviously, keyboard events were only available when you opened an app. Now, it is possible that only the top-level app needs a keyboard, and it appears. keyboard In some cases, the appearance of the keyboard may not affect your application. But sometimes, the keyboard may block an important part of your application. At this time, UIKeyboard notifications are very important. WillShow, DidShow, WillHide, DidHide, WillChangeFrame and DidChangeFrame notifications allow you to handle such problems. These notification events can be received by both applications that appear on the screen. Other considerationsThese changes (brought by multitasking) require you to consider more than just visual changes. In the past, when only one app was running in the foreground, you could use a lot of CPU, GPU and memory resources. But now it is different. If a user chooses split view or slide over view, and at the same time, he also uses the picture-in-picture feature of iOS9 to watch a video, then three apps are sharing these resources.
You need to perform more testing on your application in different situations to ensure that you are confident that it achieves the expected results and that no unnecessary resources are taken up. Further readingTo learn more about multitasking in iOS 9, read the developer center document Adopting Multitasking On iPad. I also recommend watching session 410 Continuous Integration and Code Coverage in Xcode from WWDC 2015. |
<<: Essential factors for designing a successful social game
>>: The source of programmer pain: a bug
In recent years, "2D" has become more a...
In recent years, with the implementation of housi...
© CC BY 4.0 Leviathan Press: I forgot where I saw...
The space-ground integrated quantum communication...
1. Let me start with three points that I think ma...
If children hope to find jobs in the 21st century...
Recently, a statistic of "Global Smartphone ...
The official price of English SEO tutorial is 8,0...
As an SEO personnel, the purpose of our website o...
Not long ago, at the Shanghai CJ, the domestic bl...
"100,000+" is a high ground that countl...
Earthquake intensity refers to the degree to whic...
UGC has been recognized as a way to improve produ...
As a post-90s campus entrepreneur with no resourc...