| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE.md file. | |
| 4 | |
| 5 #import "AddTodoItemViewController.h" | |
| 6 | |
| 7 @interface AddTodoItemViewController () | |
| 8 | |
| 9 @property (weak, nonatomic) IBOutlet UITextField *textField; | |
| 10 @property (weak, nonatomic) IBOutlet UIBarButtonItem *saveButton; | |
| 11 | |
| 12 @end | |
| 13 | |
| 14 @implementation AddTodoItemViewController | |
| 15 | |
| 16 - (void)viewDidLoad { | |
| 17 [super viewDidLoad]; | |
| 18 // Do any additional setup after loading the view. | |
| 19 } | |
| 20 | |
| 21 - (void)didReceiveMemoryWarning { | |
| 22 [super didReceiveMemoryWarning]; | |
| 23 // Dispose of any resources that can be recreated. | |
| 24 } | |
| 25 | |
| 26 #pragma mark - Navigation | |
| 27 | |
| 28 // In a storyboard-based application, you will often want to do a little prepara
tion before navigation | |
| 29 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
| 30 // Get the new view controller using [segue destinationViewController]. | |
| 31 // Pass the selected object to the new view controller. | |
| 32 if (sender != self.saveButton || self.textField.text.length <= 0) { | |
| 33 self.todoItem = nil; | |
| 34 return; | |
| 35 } | |
| 36 self.todoItem = [[TodoItem alloc] init]; | |
| 37 self.todoItem.itemName = self.textField.text; | |
| 38 self.todoItem.completed = NO; | |
| 39 } | |
| 40 | |
| 41 @end | |
| OLD | NEW |