Skip to content

aditya5045/ASRadioButton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

ASRadioButton

Custom Radio Button for IOS (Swift).

Implementation:

  1. Drag and Drop ASRadioButton.swift file in the project.
  2. Create an Outlet for the Radio Button:
    @IBOutlet weak var maleRadioButton: ASRadioButton!
    @IBOultet weak var femaleRadioButton: ASRadioButton!
  1. Create a method:
    fileprivate func setButtonInterface(_ sender: ASRadioButton, check: Bool) {
        sender.isChecked = check
        sender.changeFillState()
    }
  1. Create a common action for the genderButton and attach to both button:
  @IBAction func genderButtonTapped(_ sender: VURadioButton) {
        if sender == maleRadioButton {
            setButtonInterface(maleRadioButton, check: true)
            setButtonInterface(femaleRadioButton, check: false)
        }else {
            setButtonInterface(maleRadioButton, check: false)
            setButtonInterface(femaleRadioButton, check: true)
        }
   }

About

Custom Radio Button for IOS (Swift).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages