Join Tammy Coron for an in-depth discussion in this video Working with preview and commit views, part of iOS 9 3D Touch Quick Start.
- [Voiceover] When you're working with…the Preview and Commit Views, you can use…the delegate methods provided.…With UIViewControllerPreviewingDelegate,…there are two methods you'll use.…They are previewingContext:viewControllerForLocation.…This is the method that gets called…when the source view gets touched.…It's also the one responsible for blurring…the background content.…The next method you'll use is…previewingContext:commitViewController.…This gets called with the user presses more deeply…to invoke the pop action.…
This is what shows the commit view controller.…Let's see how this looks in code.…For this demo, we'll be using the 3DTouch-Example project…included with the exercise files for this chapter.…In the MasterViewController.swift file,…you can see here that I'm creating an extension…for my UIViewControllerPreviewingDelegate.…I'm also adding the two functions…that this delegate expects us to implement.…Let's take a look at the first one.…Here you can see, beginning on line 131,…I'm getting the indexPath for the row that was touched.…
In this course, Tammy Coron walks through the 3D Touch API. She shows how to add static and dynamic quick actions, which allow you to display shortcuts for app-specific tasks. She also covers peek—for displaying live previews of items—and pop, which opens a detailed version of the peek view. Last but not least, she shows how to implement custom actions using UITouch's new properties: force and maximumPossibleForce.
- Accessibility and 3D Touch
- Checking for 3D Touch availability
- Understanding static vs. dynamic actions
- Working with peek and pop views
- Working with UITouch objects