// // EspagramNewLessonViewController.m // Espagram // // Created by Abel Fokkinga on 11/13/12. // Copyright (c) 2012 Abel Fokkinga. All rights reserved. // #import "EspagramNewLessonViewController.h" @interface EspagramNewLessonViewController () @end @implementation EspagramNewLessonViewController @synthesize nameLabel = _nameLabel; @synthesize descriptionLabel = _descriptionLabel; @synthesize addButton = _addButton; @synthesize lessonDescriptionTextInput = _lessonDescriptionTextInput; @synthesize lessonNameTextInput = _lessonNameTextInput; @synthesize dataSource = _dataSource; - (IBAction)editingDidEnd:(id)sender { [self resignFirstResponder]; } - (IBAction)addButtonPressed { NSLog(@"Add button pressed with %@", self.lessonNameTextInput.text); [self.dataSource addLesson:self.lessonNameTextInput.text withDescription:self.lessonDescriptionTextInput.text]; } - (IBAction)cancelButtonPressed:(id)sender { if ( !self.dataSource ) { NSLog(@"dataSource is not set"); } NSLog(@"Cancel button pressed"); [self.dataSource cancelLesson]; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; self.nameLabel.text = NSLocalizedString(@"Lesson title", @"Lesson title when adding a new lesson"); self.descriptionLabel.text = NSLocalizedString(@"Description", @"Lesson description when adding a new lesson"); [self.addButton setTitle:NSLocalizedString(@"Add Lesson","Add button for adding a new lesson") forState:UIControlStateNormal]; [self.cancelButton setTitle:NSLocalizedString(@"Cancel Lesson","Cancel button when adding a new lesson") forState:UIControlStateNormal]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end