espagram/Espagram/EspagramNewLessonViewController.m
2013-02-21 17:08:51 +01:00

65 lines
1.9 KiB
Objective-C

//
// 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 titleLabel = _titleLabel;
@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];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.titleLabel.text = NSLocalizedString( @"Add a new lesson",@"Add a new lesson (long description)");
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