Created
September 8, 2014 15:15
-
-
Save joelman/b8527c7dd4d8aa50ab2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// recursively set answers in the case of nested views | |
-(void) setAnswers:(UIView*) view | |
{ | |
if([view isKindOfClass:[LatinTextField class]]) { | |
LatinTextField* latinTextField = (LatinTextField*) view; | |
[latinTextField setLatin:self.latin]; | |
[latinTextField setEnglish:self.english]; | |
// since KIF references things this way, we may as well. | |
NSString* inflection = latinTextField.accessibilityLabel; | |
latinTextField.stem = self.stem; | |
// could be multiple conjugation views | |
NSString* label = [self getLabel:view.accessibilityLabel]; | |
[view setAccessibilityLabel:label]; | |
NSDictionary* answers = [jsonData objectForKey:@"answers"]; | |
for(NSDictionary* answer in answers) { | |
if([inflection isEqual:[answer objectForKey:@"tag"]]) { | |
latinTextField.answer = [answer objectForKey:@"answer"]; | |
break; | |
} | |
} | |
// whatever nōn vis | |
if ([latinTextField.answer hasPrefix:@"nōn v"]) { | |
latinTextField.stem = @"nōn"; | |
} | |
[latinTextField setEnglish:self.english]; | |
if(latinTextField.answer == nil || [latinTextField.answer isEqualToString:@""]) | |
[Util toggle:latinTextField]; | |
} | |
for (UIView* child in view.subviews) { | |
[self setAnswers:child]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment