I am new to iOS XCode and am attempting to complete the initial example. Everything works as expected and in debugging with breakpoints I cannot seem to set a value from the Add To-Do Item to show up in Self.textField, so the program just skips each of these steps and I am back to the initial list. UPDATE: It definitely does not seem to pass this line of code,
if (sender != self.doneButton) return;
thus all the other code does not execute either. Is it something to do with the configuration of the Text Field in the story board? - Thanks!
In AddToDoItemViewController.m the value in the text field does not seem to come across and get stored in this code.
#import "AddToDoItemViewController.h"
@interface AddToDoItemViewController ()
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UITextField *doneButton;
@end
@implementation AddToDoItemViewController
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if (sender != self.doneButton) return;
if (self.textField.text.length > 0) {
self.toDoItem = [[ToDoItem alloc] init];
self.toDoItem.itemName = self.textField.text;
self.toDoItem.completed = NO;
}
}
In ToDoListTableViewController.m, the action just sees that item is NILL so it is done...
- (IBAction)unwindToList:(UIStoryboardSegue *)segue
{
AddToDoItemViewController *source = [segue sourceViewController];
ToDoItem *item = source.toDoItem;
if (item !=nil) {
[self.toDoItems addObject:item];
[self.tableView reloadData];
}
}
It's driving me crazy as I have everything else working fine and am learning how nice the debugger is, but I just can't see where the problem is. Do you know if you can download the final code sample somewhere?
Thanks for any help here. It's July 4th and I won't be sleeping for quite a while... :}