Description
dlRadioButton is a customizable radio button UI control for iOS.
Features
- Provides a customized radio button control.
- Allows users to select a single option from a set of mutually exclusive options.
- Supports different appearances and styles, such as circular buttons or custom images.
- Offers customization options for the button size, color, spacing, and more.
- Includes callback functions to handle user selection events.
- Compatible with iOS versions X and above.
Installation
To install dlRadioButton, you can use CocoaPods, a dependency manager for Swift and Objective-C projects. Follow these steps:
- Open your Xcode project or workspace.
- Add
pod 'dlRadioButton'
to yourPodfile
and save it. - In the terminal, navigate to your project’s directory.
- Run the command
pod install
to install dlRadioButton. - In Xcode, open the newly created
.xcworkspace
file. - Now you can import dlRadioButton in your project.
Usage
To use dlRadioButton in your app, follow these steps:
- In your ViewController, import dlRadioButton:
import dlRadioButton
- Create an instance of dlRadioButton and add it to your view:
let radioButton = DLRadioButton(frame: CGRect(x: 20, y: 100, width: 200, height: 30))
radioButton.setTitle("Option 1", for: .normal)
self.view.addSubview(radioButton)
- You can customize the appearance and behavior of dlRadioButton using its properties:
// Set button spacing
radioButton.isIconOnRight = false
radioButton.iconSize = 20
radioButton.marginWidth = 8
// Set button color and style
radioButton.indicatorColor = .blue
radioButton.indicatorPosition = .left
radioButton.indicatorAnimationStyle = .bounce
// Add event handling for selection changes
radioButton.addTarget(self, action: #selector(optionSelected), for: .touchUpInside)
For more details on how to use dlRadioButton, refer to the official GitHub repository and the CocoaDocs page.
Compatibility
dlRadioButton is compatible with iOS versions X and above.
License
dlRadioButton is available under the MIT license.