Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Mobile-Applications iPhone Radio Button Example
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
iPhone Radio Button Example
2 Answer(s)      3 years and 10 months ago
Posted in : MobileApplications


Can you please suggest me how to create Radio button in my iPhone application. Actually, in my application i have two images on UIButton 1) selected and 2) unselected ..what i want is, when a user click on that button it get selected and by default it should display unselected.

Thanks for any help in advance.


Advertisement
View Answers

March 6, 2011 at 2:23 PM


UIButton *Radiobutton = [UIButton buttonWithType:UIButtonTypeCustom];

 [Radiobutton setImage:[UIImage imageNamed:@"checkbox.png"] forState:UIControlStateNormal];

 [Radiobutton setImage:[UIImage imageNamed:@"checkedbox.png"] forState:UIControlStateSelected];

 [Radiobutton setFrame:CGRectMake(0, 0, 17, 17)];

 [Radiobutton addTarget:self action:@selector(checkboxButton:) forControlEvents:UIControlEventTouchUpInside];
     [self.view addSubview:Radiobutton];

and Action should be alike ----------------------------

- (IBAction)checkboxButton:(UIButton *)button{

     for (UIButton *Radiobutton in [self.view subviews]) {
          if ([Radiobutton isKindOfClass:[UIButton class]] && ![Radiobutton isEqual:button]) {
               [Radiobutton setSelected:NO];
          }
     }
     if (!button.selected) {
          button.selected = !button.selected;
     }
}


May 1, 2012 at 11:29 PM


Cool!Thanks for this code! But I want that to preserve the selected radiobutton,that when i again open that view ,the radiobutton which i had selected should remain selected.

Thanks in advance!



Related Tutorials/Questions & Answers:
iPhone Radio Button Example
iPhone Radio Button Example  Can you please suggest me how to create Radio button in my iPhone application. Actually, in my application i have two... click on that button it get selected and by default it should display unselected
info button iphone example
info button iphone example  I'm looking for a simple info button example in iPhone XCode. Thanks
Advertisements
radio button
radio button  On selecting a radio button, it should open a aspx page
iphone button example
 iphone button example In this tutorial we will tell you how to change the type of button in Interface Builder. There are six types of iPhone button...; 6.Add contact.     Custom: is used when an image is set on button
validation of radio button
validation of radio button  There are 3 radio button as A,B,W. there are another radio as 1,2,3.if we select W in first radio button then should select 2nd one(1,2,3).if we select A or B not need select any one from 1,2,3
Struts 2 Radio Button
radio buttons and I am using Struts2 tag.I want first rado button to be selected by default.But when i select the second radio button and hit on search button i want to retain the selection of that second radio button on search list
radio button - Development process
radio button  hi, there is 2 radio button and five text box... but when i click on cr radio button and enter value in text box.it enter the msg but it again go to sr radio button   Hi friend, Plz give full
How to play radio station on iPhone
How to play radio station on iPhone  how to play radio station on iphone
java radio button and exception
java radio button and exception  Dear Sir/Madam, I have problem with my addBagelRadioButton and addCheeseRadioButton. There should be only 1 radio button can be selected, but somehow 2 can be selected the same time. Also, I
Radio button Validation
Radio button Validation  Hi.. How to validate radio button in java?if the radio button is not selected an error message should be given... Please...()==false)){ JOptionPane.showMessageDialog(null,"Please select radio button
Query on radio button
Query on radio button  I am having a multiple row in jsp page.They are dynamically coming. For each row there is one radio button. I want to select one row only, i.e I want to fetch the value of row and on submitting the page
dependent radio button
of the Radio Button is to select only one option at a time. So you don't need...dependent radio button  Hi. I have 4 radio buttons say all,chocolate,cookie,icecream. If I select all the other 3 should not able to be selected
radio button - Development process
radio button  hello,i want to creat two radio button.out of which only one can be selected.and can show the contain of selected radio box   Hi friend, Code to solve the problem : My Page Radio 11
access into radio button
access into radio button  access the four fields of database called access,access file and stored in radio button.please help
passing value of radio button
passing value of radio button  hi,i have 3 jframe built using the GUi editor in net beans 6.9. i have two radio button in the first jframe.i have to get the selected item appear on the 3rd frame after passing through the second
validate radio button using javascript
validate radio button using javascript  validate radio button using javascript
Radio Button in J2ME
Radio Button in J2ME      ... to demonstrate, how to create the radio button in J2ME using MIDlet. The radio button is use to choose only one option at a time. To create the radio button we
Radio Button Problem in jsp.
Radio Button Problem in jsp.  I have a small doubt in my application, my requirement is to get a "single selectible row", I generated a radio button... radio button values from jsp to action using javascript
handling Button Event in iphone
handling Button Event in iphone  handling Button Event in iphone
Dojo Radio Button
Dojo Radio Button         .... For creating radio button you need "dijit.form.CheckBox". The radio button do some action on press.  Try Online: Radio Button The RadioButton class
radio button in jsp - JSP-Servlet
radio button in jsp  hye there.how do I create radio button in jsp?Could you please gimme an example of shopping cart in jsp which have I have using a Netbean not a tomcat.What is the code for view and update in jsp?Thanks
Radio button in JSP - JSP-Servlet
Radio button in JSP  Hi! In my page I have two radio buttons. If i select first radio button. one text field has to be displayed.... If i select second radio button. text field has to be disappeared. pls.... help me.. 
Radio Button in Java
. Let us take a Example that helps you in Understanding to create a Radio Button... Radio Button in Java       Radio Button is a circular button on web page that can be selected
Using radio button in struts - Struts
Using radio button in struts  Hello to all , I have a big problem... options to choose : Serial number 12345 radio button - selection 1 radio button - selection 2 Serial number 6789 radio button - selection 1 radio button
to get radio button value - Struts
to get radio button value   hello friend, i have a problem regarding... two major problems:- 1.these radio button is not going to select also 2.i want to set the "value" attribute of radio button in the above code. Can u help
iphone button click event
iphone button click event  Hi, How to write iphone button click event? Thanks   Hi, Here the method declaration: -(IBAction) myMetod...{ NSLog(@"Button clicked"); } Thanks
Radio Button in HTML
Radio Button in HTML is a type of input form that allows a user to select one button from a group of button. When a user clicks on a radio button, it becomes...; specifies the component type is radio button or not. If a programmer use type="radio
Radio buttons in html
Radio buttons in html Here is an example of radio button in html.In this example we have display two radio button Male and Female. The user select only one.... Example radioButton.html <html> <head><title>Radio button
Radio button validation using jsp - JSP-Servlet
Radio button validation using jsp  I had one jsp Page and servlet. I did my validations in servlet for my jsp page which contains the radio... a value for radio Buttons) then it will return to same jsp page with the given
radio button value on edit action
radio button value on edit action  This is my edit.jsp code...In my......Problem 'm facing is on edit action 'm not retrieving radio button value..i have used if else logic..Bt its not working...My edit.jsp code is:-Radio button name
iPhone Detail Disclosure Button
iPhone Detail Disclosure Button In iPhone based applications, detail disclosure are used to show the detailed information of list items. On clicking it .. it'll bring up the detail information about the item in list. We can also say
 

 

 

DMCA.com