0

Im a newbie in iOS development. Im using FXForm to create a UITableview based form. Ive used FXFormFieldOptions field for multiple selection by setting the FXFormFieldType to bitfield. I need the index paths for selected options in the options list.

    @{FXFormFieldKey: @"language",
      FXFormFieldOptions: @[@"English", @"Spanish", @"French", @"Dutch"],FXFormFieldType:FXFormFieldTypeBitfield},

Could you provide some explanation or help please.

Oleg Gordiichuk
  • 15,240
  • 7
  • 60
  • 100

1 Answers1

0
  1. Have a class which confirms to the protocol <FXForm>
  2. Have a NSInteger property called language in the class you created in step 1
  3. In the class you created in step 1 implement the method - (NSArray *)fields. A sample implementation is shown below.

-(NSArray *)fields

{
    NSArray *basicFields = @[
                             @{FXFormFieldKey: @"language",
  FXFormFieldOptions: @[@"English", @"Spanish", @"French", @"Dutch"]},
                             ];

    NSArray *controlFields = @[
                               @{FXFormFieldTitle: @"Submit", FXFormFieldAction: @"submitTapped:"},
                               ];


    return [basicFields arrayByAddingObjectsFromArray:controlFields];

}
  1. In the view controller you are displaying the form implement the method - (void) submitTapped:(UITableViewCell *)cell as follows.

    -(void) submitTapped:(UITableViewCell *)cell

    {

    YourClassName *form = (YourClassName *)cell.field.form;

    }

You could access the language property of the object form to get the selected index path.

ThE uSeFuL
  • 1,456
  • 1
  • 16
  • 29