Version 0.2
This commit is contained in:
@@ -14,40 +14,8 @@
|
||||
|
||||
@implementation EspagramConjugationTableViewController
|
||||
|
||||
@synthesize dataSource = _dataSource;
|
||||
@synthesize verb = _verb;
|
||||
|
||||
- (void) dataSource:(id <EspagramConjugationTableView>) dataSource {
|
||||
_dataSource = dataSource;
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)verbEntered:(id)sender {
|
||||
[self.view resignFirstResponder];
|
||||
}
|
||||
|
||||
- (id)initWithStyle:(UITableViewStyle)style
|
||||
{
|
||||
self = [super initWithStyle:style];
|
||||
if (self) {
|
||||
// Custom initialization
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) reloadData {
|
||||
if (_dataSource) {
|
||||
NSLog(@"language %@", [self.dataSource.conjugator description]);
|
||||
NSLog(@"persons %d", self.dataSource.conjugator.persons.count);
|
||||
[self.tableView reloadData];
|
||||
} else NSLog(@"Datasource is nil");
|
||||
}
|
||||
|
||||
|
||||
- (void)didReceiveMemoryWarning
|
||||
{
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
#pragma mark - Table view data source
|
||||
|
||||
@@ -55,12 +23,11 @@
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
// Return the number of rows in the section.
|
||||
return [[[self.dataSource conjugator] persons] count];
|
||||
return [[[self.verb.lesson getConjugationEngine] persons] count];
|
||||
}
|
||||
|
||||
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
|
||||
@@ -69,7 +36,7 @@
|
||||
switch (section)
|
||||
{
|
||||
case 0:
|
||||
sectionName = self.dataSource.verb;
|
||||
sectionName = self.verb.verb;
|
||||
break;
|
||||
default:
|
||||
sectionName = @"";
|
||||
@@ -88,20 +55,20 @@
|
||||
}
|
||||
|
||||
|
||||
NSString * person = [[self.dataSource.conjugator personsKeys] objectAtIndex:indexPath.row];
|
||||
cell.textLabel.text = [self.dataSource.conjugator.persons objectForKey:person];
|
||||
cell.detailTextLabel.text = [self.dataSource.conjugator conjugateVerb:self.dataSource.verb inPerson:person andTense:self.dataSource.tense];
|
||||
NSString * person = [[[self.verb.lesson getConjugationEngine] personsKeys] objectAtIndex:indexPath.row];
|
||||
cell.textLabel.text = [[[self.verb.lesson getConjugationEngine] persons] objectForKey:person];
|
||||
cell.detailTextLabel.text = [[self.verb.lesson getConjugationEngine] conjugateVerb:self.verb.verb inPerson:person andTense:[self.verb.lesson getTenseAsTense]];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad
|
||||
- (void) viewDidAppear:(BOOL)animated
|
||||
{
|
||||
[self.tableView reloadData];
|
||||
[super viewDidAppear:animated];
|
||||
self.title = [[self.verb.lesson getTenseAsTense] getTenseInLanguage:self.verb.lesson.conjugator];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - Table view delegate
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
|
||||
Reference in New Issue
Block a user