Join Tammy Coron for an in-depth discussion in this video Working with UITouch objects, part of iOS 9 3D Touch Quick Start.
- [Voiceover] Let's take a look…at force properties in UITouch objects.…In the exercise files for this chapter,…you'll notice a 3D Touch example project.…That's the one that I'm working with now,…and in this project I essentially have a single view,…and on that view I have two labels,…one to hold the value of force,…and one to hold the value of maximumPossibleForce,…and I also have a reset button in the top right hand side.…The way that this app works is every time…you apply pressure to the touch screen,…a line will draw on the left hand side.…
Also, the values within those two labels…will update depending on how much pressure you apply.…So you could see here that the lighter I apply pressure,…the smaller the number, the thinner the line.…The more pressure I apply,…the thicker the line and the higher the number.…When I'm all done making lines on the screen,…I can simply hit the Reset button to draw again.…So let's see what this looks like in code.…If you go out here to the ViewController.swift file,…essentially what I've got is I'm using my Touch…
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