Giter VIP home page Giter VIP logo

dlradiobutton's Introduction

DLRadioButton

Version License Platform Carthage compatible

DLRadioButton is an easy to use and highly customizable radio buttons control for iOS. It's a subclass of UIButton, and works smoothly with both Objective-C and Swift.

Since its release, DLRadioButton has become the most popular radio buttons control for iOS 🎉. Thank you for all the great feedback and making it better for all of us 👏.

Preview

screenshot1

Usage

To install:

  • Option 1: simply put DLRadioButton.h and DLRadiobutton.m in your project.
  • Option 2: add pod 'DLRadioButton', '~> 1.4' to your Podfile.
  • Option 3: add github "DavydLiu/DLRadioButton" ~> 1.4 to your Cartfile.

To add radio buttons in interface builder:

  1. Put some UIButtons onto a View and change the UIButtons' type to "custom".

    change UIButton Type

  2. Set the UIButtons' class to "DLRadioButton".

    change UIButton Class

  3. Set "otherButtons" outlet.

    set otherButtons outlet

To customize DLRadiobutton:

  • Simply set properties directly in Interface Builder.

    design DLButton

  • Property reference:

    DLRadioButton

To add radio buttons programmatically, please refer to the example project.

Requirements

ARC, iOS 6.0

Author

David Liu. For help or any questions, feel free to open an issue.

License

DLRadioButton is available under the MIT license.

dlradiobutton's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dlradiobutton's Issues

DLRadioButton problem

Hi!

I installed DLRadioButton using cocoapods and when I try to add button to my storyboard and set the class to DLRadiobutton I receive an information about 3 issues. Screenshot bellow:
zrzut ekranu 2016-06-02 o 19 12 34

How can I solve this problem and use your framework?

DLRadioButton with Swift 2

Can you give an example of how to use checkbox with Swift 2? I have set up an IBAction outlet and a IBOutlet but there is no intellisense that pops up so I am at a lost where to do from here. I am a newbie to Swift. I want to create a checkbox and by default it is not checked.

Changing Icon Color

Hi David,

Amazing Library thus far.

I have a question regarding tint color and selected icons.

How can I make it so that when a button is selected, it just changes to the image I set in Icon Selected without applying a tint color to it or using the tint as part of the transformation?

Thank you,
Jordan

problem of custom the button

I want to set a color when button clicked, and another color when button not selected. But I can't do it with storyboard. Because the first button's default style always be the selected style.

RadioButton showing only after selection

Hi, I have a small problem with your library. The radio button only appear after I select it for some reason.
As shown on screenshot below:

Any idea what is going on? Thanks :)

Change event

Hi! Is it possible to change touch action event from UIControlEventTouchDown to UIControlEventTouchUpInside? There is a problem with buttons on scrolling view. When you try to scroll by touching radio button area, event is called but it shouldn't.

Set "otherButtons" outlet

Hi, good day,

How do I set "otherButtons" outlet? In interface editor or program?

Thanks and have a good one.

Cheng

Use As Toggle

Hi,

Love this! However I cannot figure out how to use the checkbox as a toggle? For instance just have one checkbox and have it selectable and unselectable. Maybe I am just overlooking something simple!

Thanks!

How to loop through otherButtons for radiobox?

I'm new to swift/ios dev. Came across your library and found it extremely useful. However, I'm wondering if there's a quick way to retrieve the current selection in the group?

For example, i have 4 options A,B,C,D. Can I group them under 'radioGroup1' and just do a radioGroup1.selected or something like that to directly get the value of the selected?

Radio icon only appear after selecting particular button

First of all thank you for creating DLRadioButton. The issue I want to discuss is as below.

I have added two radio buttons. Buttons are added using interface builder.

When the view loads up the round icon on the left of the button does not show.
But when I select the button round icon shows for that button and same for other button.

Once they are appeared both works fine.

I don't understand what is the problem. Help me here.
Thanks.

I cant deselect the redio button.

I am beginner in swift IOS I used this library is very nice But Problem is once i select it. I cant deselect. Please help me with this problem.

I am taking two new UIButtons and I used custom class as DLRadioButton. If button group is require for that Just let me know how to get it exactly.

Thanks.

drawing issue

I'm creating the buttons programmatically and adding them to the cell of a tableview. They are not drawing.

Possible to use as checkbox?

Hi DavydLiu,

Is this possible to be implemented as checkbox button? if so how do we do it in swift as I don't seems to be able to toggle it's state for checked and unchecked display.

Connecting DLRadioButton to Swift

I went through the procedure to establish a Podfile containing DLRadioButton. I follow what you are saying about putting a button on my storyboard and changing it to a custom one of DLRadioButton. But it doesn't seem to be able to find the DLRadioButton as an object. Somehow I'm not putting DLRadioButton into the Podfile in such a manner that Swift is able to locate it or am not inserting a proper syntax in my storyboard file to refer to it. My Podfile contains:

Uncomment this line to define a global platform for your project

platform :ios, '9.0'

target 'ageCalculator' do

Comment this line if you're not using Swift and don't want to use dynamic frameworks

use_frameworks!

Pods for ageCalculator

pod 'DLRadioButton', '~> 1.4'

end

Might you have any idea of where I went astray? Any help would be greatly appreciated.

Thanks...

John

set mutiple to yes there was an exception

when i set the mutiple to yes ,there was came out a exception :-[UIImage selectedButtons]: unrecognized selector sent to instance 0x7fd3aca57050,but when set the mutiple to no ,it's worked fine

Suggested improvement

Thanks for your nice DLRadioButton package. I made one improvement to a copy of your software which I'll suggest in case you want to add it. Basically I took out the otherButtons array and replaced them with a single mutable set shared among all buttons in a group, added a new -groupWithButton: method, and changed a few places internally to use the set rather than the arrays. If you want the change, let me know and I'll be glad to provide it. Thanks.

How can I set radiobutton selected in the begining?

Thank you for great library!

I want to show people with layout that one button is already selected.

How can I set a selected button before people click?

I am sorry for simple question, since I am new to programming.

Pre-Select any button Programmatically

Dear,

Thank you for providing very clean code library.

Well, I am using your code in my SWIFT application. So, I am unable to access the function setSelected(Bool). So, I am looking forward to pre-select any one button from a group of two programmatically. How can I achieve this functionality?

API Documentation and simple example usage guide

this project is looks good but there is no api documentation so its hard to figure out everything , so it would be nice that we have documentation and simple usage guide both in swift and ios.

thanks you for this awesome library.

How Do I Show a radio button selected by default?

Thank for the great work..! I was just concern about how do I show a radio button selected by default because all the buttons are deselected by default and the user may or may not be clicking on the radio button because I cannot force them to do so . Thats why I just want that any of the radio group button should be shown as selected by default. Is there any way to do this??

Thanks

radio button

how can i choose only one radio button and unselect other using swift

circleColor - Hit an exception when attempting to set its value

Hi there,
I am just updating my project to xCode7 and iOS9 and encountered this error for every instance of DLRadioButton in my Storyboard? It also occurs for circleRadius. Setting them manually to the default and restarting xCode didn't work. Any ideas or ideas for a fix? BTW I am using Swift 2.0 / iOS9 / xCode7

file:///blah/blah/Base.lproj/Main.storyboard: warning: IB Designables: Ignoring user defined runtime attribute for key path "circleColor" on instance of "DLRadioButton". Hit an exception when attempting to set its value: [<DLRadioButton 0x7fd4f245b220> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key circleColor.

Seems like because they are set to default it triggers an error. When I set them all manually to a default value in IB I get another error as below:

file:///blah/blah/Base.lproj/Main.storyboard: error: IB Designables: Failed to update auto layout status: The agent crashed

file:///blah/blah/Base.lproj/Main.storyboard: error: IB Designables: Failed to render instance of DLRadioButton: The agent crashed

I have tried clearing my Derived Data folder but warnings persist.

How to change a selected radio's color

Hello,

I'm using this library in my project (Swift) and I don't know how to change to color of a selected radio in runtime.

This is before
screen shot 2016-04-22 at 4 30 27 pm
After
screen shot 2016-04-22 at 4 30 39 pm

You can see color of the third radio button (selected) does not change.

This is how I tried to change the color.

func setButtonColor(button: UIButton, color: UIColor){
        button.setTitleColor(color, forState: UIControlState.Disabled)
        button.setTitleColor(color, forState: UIControlState.Normal)
        button.setTitleColor(color, forState: UIControlState.Highlighted)
        button.setTitleColor(color, forState: UIControlState.Selected)
        button.setTitleColor(color, forState: UIControlState.Reserved)
        button.setTitleColor(color, forState: UIControlState.Focused)
        button.setTitleColor(color, forState: UIControlState.Application)
 }

Please help me solve this problem.
Thank you.

Problem creating widget

Hi, I'm using Xcode 7.3. I just added the DLRadioButton.m and DLRadioButton.h on my project as said on option 1 of the installation guide.
I was able to assign the class DLRadioButton to a button and compile the application. However when I import DLRadioButton on my swift code in order to create a widget I got an error saying that the DLRadioButton module does not exists.
My code was written in swift.

What can I do?

Thanks

Release Less Versions

Absolutely love this pod but I find it increasingly frustrating that the version number keeps on incrementing without any good reason

As an example, the latest version 1.4.4 contains just one commit that fixes a bug in the demo project. The demo project should not be impacted by versioning whatsoever.

Please can we take versioning a bit more seriously. Happy to help

Redraw button on color changes

I am using this control in a way where the selected and not selected states have different colors besides the inner circle being drawn.
If you change the icon or indicator color the buttons aren't redrawn using the new colors.

It would be nice to see the addition to be able to set a color for the selected state.
Another way would be to force a redraw if the colors of the control have changed.

The workaround I found was to set the icon or iconselected to nil and calling setNeedsDisplay to force a redraw for the newly assigned color. Which seems to me as a bit hacky.

setVisibility option

Hi, First of all thanks for your great work. Do this buttons have a setVisibility option or something like that? because when I use .hidden I can hide the button but when I set it equal to false the button doesn't appear again.

Thanks

inverse colors?

No matter what settings I change, the button will always have white inner and outer circles and the background will be blue (or whatever color i set the button tint to). Your color IBInspectables seem to have no effect.

DLRadioButton question

I like how the radio buttons in DLRB interact, but I also want a button to deselect if it is selected with a second touch. My intent is for all the buttons to be deselected as when the app first opened. How can DLRadioButton be updated to do this?

Thanks for the help, I am new and learning.

rendering took too long?

Hello, first of all thanks for the great code! In my storyboard, I get the error error: IB Designables: Failed to render instance of DLRadioButton: Rendering the view took longer than 200 ms. Your drawing code may suffer from slow performance. The app runs but the red error is always there. Is anything affecting performance, and any way to get rid of this error? Thanks again!

Failed to render instance of DLRadioButton

I am getting this error everytime I run my project. Using storyboard. Xcode version 7.2.

" Failed to render instance of DLRadioButton: Rendering the view took longer than 200 ms. Your drawing code may suffer from slow performance." And as said, the UI gets stuck for some time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.