Recipe: Building a Touch Wheel
This next recipe creates a touch wheel, like the ones used on older model iPods. Touch wheels provide infinitely scrollable input. Users can rotate their finger clockwise or counterclockwise, and the object’s value increases or decreases accordingly. Each complete turn around the wheel (that is, a traversal of 360 degrees) corresponds to a value change of 1.0. Clockwise changes are positive; counterclockwise changes are negative. The value accumulates on each touch, although it can be reset; simply assign the control’s value
property back to 0.0
. This property is not a standard part of UIControl
instances, even though many controls use values.
This recipe computes user changes by casting out vectors from the control’s ...
Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.