Open tony98789 opened 9 years ago
You have to subclass an UITableViewCell and add the IBOutlets. Also the XLFormField *field:
#import "FXForms.h"
@interface SubroutineRow : UITableViewCell<FXFormFieldCell, UITextFieldDelegate>
@property (strong, nonatomic) FXFormField *field;
@property (strong, nonatomic) IBOutlet UITextField *nameTextField;
@property (strong, nonatomic) IBOutlet UITextField *timeTextField;
@end
If you have two UITextFields, set the delegates and assign them tags to differentiate them. In this code I assigned NAME_TAG and TIME_TAG.
In your implementation file, set the "field" as a dictionary with the two values:
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
NSString *tempString;
tempString = [textField.text stringByReplacingCharactersInRange:range withString:string];
switch (textField.tag) {
case NAME_TAG:
[dictionary setObject:tempString forKey:@"name"];
break;
default:
[dictionary setObject:tempString forKey:@"time"];
break;
}
self.field.value = dictionary;
return YES;
}
Hi i am trying to use a custom cell with two fields, there was a similar post on here but i could not understand it. I have a class called location that contains two property gpsx and gpsy, originally these where two separate property in the form but i believe for the custom cell they should be one class that i then use in the form.
The issue i am having is i have created a custom cell with two labels and two text fields that would show the gpsx and the gpsy title and value, however i do not know how to map the values. Any guidance would be brilliant as i have been trying to figure this out for sometime now. Currently in my app the gps x and y are in two separate cells but it would be much cleaner if they where together. Thank you for any help or even an example.