All Projects → Abedalkareem → AMChoice

Abedalkareem / AMChoice

Licence: MIT License
Radio Button and check box for iOS

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to AMChoice

react-native-radio-buttons-group
Simple, best and easy to use radio buttons for react native apps.
Stars: ✭ 145 (+222.22%)
Mutual labels:  radio, button, radio-buttons
react-native-animated-radio-button
Fully customizable animated radio button for React Native
Stars: ✭ 25 (-44.44%)
Mutual labels:  radio, button, radio-button
Tristatetogglebutton
Customizable tri-state toggle button (with three states, three state toggle) for Android
Stars: ✭ 198 (+340%)
Mutual labels:  button, radio-buttons
Segmentedbutton
Segmented Control with animation for Android API 12+
Stars: ✭ 352 (+682.22%)
Mutual labels:  button, radio-buttons
Radiorealbutton
A custom radio button for Android API 12+
Stars: ✭ 250 (+455.56%)
Mutual labels:  button, radio-buttons
Examples Win32
Shows how to use Win32 controls by programming code (c++17).
Stars: ✭ 22 (-51.11%)
Mutual labels:  button, radio-buttons
React Native Selectmultiple Button
A button (or a grouped buttons) supporting multiple or radio selection by building with React Native. https://github.com/danceyoung/selectmultiplebuttons for Swift.
Stars: ✭ 72 (+60%)
Mutual labels:  radio, button
jackpifm
📡 Turn your Raspberry Pi into an FM transmitter broadcasting live audio from JACK
Stars: ✭ 21 (-53.33%)
Mutual labels:  radio
findlargedir
find all "blackhole" directories with a huge amount of filesystem entries in a flat structure
Stars: ✭ 15 (-66.67%)
Mutual labels:  check
react-native-progress-button
A react native button component that can show progress.
Stars: ✭ 17 (-62.22%)
Mutual labels:  button
system-checks
⚙ Checks and shows Linux system info - Distro name, IP, running processes and etc. Official site - system-checks.org
Stars: ✭ 35 (-22.22%)
Mutual labels:  check
DABDUINO
The DABDUINO is DAB/DAB+/FM Arduino shield with 32-bit, 384kHz PCM DAC (cinch) + Toslink optical digital audio output.
Stars: ✭ 34 (-24.44%)
Mutual labels:  radio
vor-python-decoder
Decodes VOR signal from WAV file to get the bearing to your position
Stars: ✭ 33 (-26.67%)
Mutual labels:  radio
awesome-web-styling
Awesome Web Styling with CSS Animation Effects ⭐️
Stars: ✭ 109 (+142.22%)
Mutual labels:  button
SweetLike
A beautiful like button written in Swift.
Stars: ✭ 13 (-71.11%)
Mutual labels:  button
nfc-laboratory
NFC signal and protocol analyzer using SDR receiver
Stars: ✭ 41 (-8.89%)
Mutual labels:  radio
nrsc5-dui
An enhanced, user-friendly version of nrsc5-gui that is not heavily dependent upon Python processing for audio generation.
Stars: ✭ 49 (+8.89%)
Mutual labels:  radio
FT857d
CAT support for Arduino, simulating a Yaesu FT-857D
Stars: ✭ 31 (-31.11%)
Mutual labels:  radio
react-bootstrap-button-loader
React ButtonLoader with Bootstrap flavor
Stars: ✭ 25 (-44.44%)
Mutual labels:  button
nestjs-redis
Redis(ioredis) module for NestJS framework
Stars: ✭ 112 (+148.89%)
Mutual labels:  check

Radio Button and check box for iOS

ScreenShots

Usage

1-Add UIView to your view controller and set custom class AMChoice

2-Set the image for select and unselect (you can set it programmatically)

3-Creat new model and implement Selectable protocol , by implementing Selectable protocol you must add three variabel: (title,isSelected,isUserSelectEnable)

class VoteModel: NSObject,Selectable {
    var title: String
    var isSelected: Bool = false
    var isUserSelectEnable: Bool = true 
    
    init(title:String,isSelected:Bool,isUserSelectEnable:Bool) {
        self.title = title
        self.isSelected = isSelected
        self.isUserSelectEnable = isUserSelectEnable
    }
}

4-Set the data (items) for AMChoice view, the item may come from server or static in your code like i have done

amChoiceView.data = myItems 

More

You can make any customise to the AMCHoice view (see viewDidLoad ) , or you can implement the AMChoiceDelegate protocol to get the selected index, see the comment in the code below to know more

class ViewController: UIViewController,AMChoiceDelegate {
    
    
    @IBOutlet weak var amChoiceView: AMChoice!

    let myItems = [
        VoteModel(title: "Will smith", isSelected: false, isUserSelectEnable: true),
        VoteModel(title: "Al pacino", isSelected: false, isUserSelectEnable: true),
        VoteModel(title: "Abedalkareem", isSelected: false, isUserSelectEnable: true),
    ]
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        amChoiceView.isRightToLeft = false // use it to support right to left language
        
        amChoiceView.delegate = self // the delegate used to get the selected item when pressed
        
        amChoiceView.data = myItems // fill your item , the item may come from server or static in your code like i have done
        
        amChoiceView.selectionType = .single // selection type , single or multiple
        
        amChoiceView.cellHeight = 50 // to set cell hight
        
        amChoiceView.arrowImage = nil // use ot if you want to add arrow to the cell
        
        // you can set the selected and unselected image programmatically
        amChoiceView.selectedImage = UIImage(named: "selectedItem")
        amChoiceView.unselectedImage = UIImage(named: "unSelectedItem")
        
        
        
        
       
    }
    
    // get the selected item when pressed
    func didSelectRowAt(indexPath: IndexPath) {
        print("item at index \(indexPath.row) selected")
    }

   
    @IBAction func submit(_ sender: Any) {
        let selectedItems = amChoiceView.getSelectedItems() as! [VoteModel] // use getSelectedItems to get all selected item
        print(selectedItems)
        
        let selectedItemCommaSeparated = amChoiceView.getSelectedItemsJoined(separator: ",") // use getSelectedItemsJoined to get all selected item joined with separator (if the selection type multiple)
        print("\n\n\nComma Separated: \n \(selectedItemCommaSeparated)")
    }


}

Installation

Just add AMChoice.swift in your project

Note

I'm going to be very happy if you give me a feedback or advice , thank you

License

The MIT License (MIT)

Copyright (c) 2017 Abedalkareem

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].