SMWheelControl
SMWheelControl is a customizable UI control for iOS that allows users to select a value by rotating a wheel-like interface. It’s easy to use and highly flexible, providing options to customize the appearance and behavior.
Features
- Easy integration into your iOS projects
- Highly customizable appearance and behavior
- Smooth rotation and value selection
- Supports both horizontal and vertical wheel layouts
- Animated transitions when changing values
- Support for minimum and maximum values
- Delegate methods for value changes and user interactions
Requirements
SMWheelControl supports iOS 9.0 and later.
Installation
You can integrate SMWheelControl into your project using either CocoaPods or manually.
Installation with CocoaPods
To install SMWheelControl using CocoaPods, add the following line to your Podfile:
pod 'SMWheelControl'
Then, run the command pod install
in the terminal.
Manual Installation
If you prefer to manually add SMWheelControl to your project, follow these steps:
- Download the SMWheelControl framework
- Drag and drop the framework into your Xcode project
- Make sure to select your target and check “Copy items if needed”
Usage
To use SMWheelControl in your iOS application, follow these steps:
- Import the SMWheelControl module
- Create an instance of SMWheelControl
- Set the desired properties such as colors, fonts, and wheel layout
- Implement the delegate methods to handle value changes and user interactions
- Add the SMWheelControl instance to your view hierarchy
Here is an example of how to use SMWheelControl:
import SMWheelControl
class ViewController: UIViewController, SMWheelControlDelegate {
var wheelControl: SMWheelControl!
override func viewDidLoad() {
super.viewDidLoad()
wheelControl = SMWheelControl(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
wheelControl.delegate = self
// Configure custom properties
wheelControl.numberOfSegments = 12
wheelControl.minValue = 0
wheelControl.maxValue = 100
view.addSubview(wheelControl)
}
// Implement SMWheelControlDelegate methods
func wheelControl(_ wheelControl: SMWheelControl, didSelectValue value: CGFloat) {
print("Selected value: \(value)")
}
}
Customization
SMWheelControl provides various properties to customize its appearance and behavior:
backgroundColor
: The background color of the controlnumberOfSegments
: The number of segments in the wheelselectedSegmentColor
: The color of the selected segmentunselectedSegmentColor
: The color of the unselected segmentsindicatorColor
: The color of the indicatorindicatorImage
: The custom image to use for the indicatorindicatorWidth
: The width of the indicatorindicatorInsets
: The insets of the indicatorminValue
: The minimum selectable valuemaxValue
: The maximum selectable valueallowTap
: Whether to allow tap gestures to select valuesallowSwipe
: Whether to allow swipe gestures to select valuesdelegate
: The delegate for receiving value change events
Delegate Methods
SMWheelControl provides the following delegate methods:
wheelControl(_:didSelectValue:)
: Called when the user selects a valuewheelControl(_:willStartRotating:)
: Called when the wheel starts rotatingwheelControl(_:didEndRotating:)
: Called when the wheel stops rotating
License
SMWheelControl is released under the MIT License. See the LICENSE file for more details.