Je pourrais avoir besoin d'aide. J'utilise XLForm dans mon projet Objective-C. J'ai une première rangée avec un sélecteur où vous avez quatre options différentes. Ensuite, il y a un deuxième sélecteur. Mais le second sélecteur ne doit être disponible que si une certaine valeur est sélectionnée dans le premier sélecteur.XLForm - Comment masquer une ligne en fonction de la valeur d'une autre ligne?
Je sais qu'il y a une description sur le site github mais je ne comprends pas vraiment quoi faire. Alors aidez-moi s'il vous plaît à faire ça.
Voici les parties pertinentes de mon code:
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"repeat" rowType:XLFormRowDescriptorTypeSelectorPickerViewInline title:@"Wiederholen:" ];
row.cellClass = [LehrerXLFormInlineSelectorCell class];
NSMutableArray *selectionArray = [NSMutableArray array];
for (NSNumber *item in [APIDataReplacement appointmentRepeatingList]) {
NSString *title = [APIDataReplacement appointmentRepeatingToString:item.intValue];
[selectionArray addObject:[XLFormOptionsObject formOptionsObjectWithValue:item displayText:title]];
}
row.selectorOptions = selectionArray;
if ([selectionArray count] == 0) {
[row setDisabled:@YES];
}
if (aItem) {
int repeatingID = [[aItem appointmentRepeatingId] intValue];
NSString *title = [APIDataReplacement appointmentRepeatingToString:repeatingID];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:[NSNumber numberWithInt:repeatingID] displayText:title];
}else{
NSNumber *first = [[APIDataReplacement appointmentRepeatingList] firstObject];
NSString *title = [APIDataReplacement appointmentRepeatingToString:first.intValue];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:first displayText:title];
}
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@""];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"weekday" rowType:XLFormRowDescriptorTypeSelectorPickerViewInline title: @"Wochentag:"];
row.cellClass = [LehrerXLFormInlineSelectorCell class];
NSMutableArray *selectionArray1 = [NSMutableArray array];
for (NSNumber *item in [APIDataReplacement dayList]) {
NSString *title = [APIDataReplacement dayToString:item.intValue];
[selectionArray1 addObject:[XLFormOptionsObject formOptionsObjectWithValue:item displayText:title]];
}
row.selectorOptions = selectionArray1;
if (aItem) {
// AppointmentRepeating *currentRepeat = [aItem appointmentRepeating];
int dayID = [[aItem startday] intValue];
NSString *title = [APIDataReplacement dayToString:dayID];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:[NSNumber numberWithInt:dayID] displayText:title];
}else{
NSNumber *first = [[APIDataReplacement dayList] firstObject];
NSString *title = [APIDataReplacement dayToString:first.intValue];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:first displayText:title];
}
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@""];
[form addFormSection:section];
Ce sont les deux ramasseurs. Je pense que je devrais faire quelque chose dans la méthode formRowDescriptorValueHasChanged, mais je ne sais pas quoi. Si le premier sélecteur a la valeur "20", le second sélecteur doit être masqué.
Vraiment apprécier votre aide.