How To Make a Custom Control Tutorial: A Reusable Knob | Ray Wenderlich

Custom UI controls are extremely useful when you need some new functionality in your app — especially when they’re generic enough to be reusable in other apps. This custom control tutorial covers the creation of a control kind of like a circular slider inspired by a control knob, such as those found on a mixer.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/56885/custom-control-for-ios-tutorial-a-reusable-knob

This is a great tutorial, thank you. I do wish that the magic numbers were explained. For example:
CGFloat(-Double.pi) * 11 / 8

Also, I would appreciate it if tutorials like this specified the units being handled, specifically when we are dealing with degrees vs radians.
Thanks again, Cliff

@lorenzoboaro Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @cliffspencer! Thanks for your feedback.

About the magic numbers, these are used in order to draw the non-closing circle that represents the track of the knob. The negative number is -247.5°, while the positive is 67.5°.

About your suggestion, yes, it will definitely useful to introduce the new Measurement API introduced by Apple. In this way, from a consumer perspective, it could be easier to reason about.

For any additional questions, let me know.

Thanks, Lorenzo

Thanks, @lorenzoboaro.
Cliff