Best radio-button implementation for IOS

后端 未结 8 574
心在旅途
心在旅途 2020-11-29 20:50

I would like to ask if there are examples out there on how to implement radio-button options on an iPhone app.

I find the Picker View quite big for a simple selectio

相关标签:
8条回答
  • 2020-11-29 21:45

    I know its very late to answer this but hope this may help anyone.

    you can create button like radio button using IBOutletCollection. create one IBOutletCollection property in our .h file.

    @property (nonatomic, strong) IBOutletCollection(UIButton) NSArray *ButtonArray;
    

    connect all button with this IBOutletCollection and make one IBAction method for all three button.

    - (IBAction)btnTapped:(id)sender {
           for ( int i=0; i < [self.ButtonArray count]; i++) {
               [[self.ButtonArray objectAtIndex:i] setImage:[UIImage                         
                imageNamed:@"radio-off.png"]                 
                forState:UIControlStateNormal];
           }
         [sender setImage:[UIImage imageNamed:@"radio-on.png"]
          forState:UIControlStateNormal];
    }
    
    0 讨论(0)
  • 2020-11-29 21:53

    For options screens, especially where there are multiple radio groups, I like to use a grouped table view. Each group is a radio group and each cell a choice within the group. It is trivial to use the accessory view of a cell for a check mark indicating which option you want.

    If only UIPickerView could be made just a little smaller or their gradients were a bit better suited to tiling two to a page...

    0 讨论(0)
提交回复
热议问题