EditTableViewController.m (3329B)
1 #import "EditTableViewController.h" 2 3 @interface EditTableViewController () 4 5 @end 6 7 @implementation EditTableViewController 8 9 - (void)viewDidLoad 10 { 11 [super viewDidLoad]; 12 [self.list_name becomeFirstResponder]; 13 } 14 15 16 - (void)didReceiveMemoryWarning 17 { 18 [super didReceiveMemoryWarning]; 19 // Dispose of any resources that can be recreated. 20 } 21 22 #pragma mark - Table view data source 23 24 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 25 { 26 // Return the number of sections. 27 return 1; 28 } 29 30 - (IBAction)name_editing_ended:(id)sender 31 { 32 33 NSIndexPath *name_path = [NSIndexPath indexPathForRow:0 inSection:0]; 34 UITableViewCell *name_cell = [self.tableView cellForRowAtIndexPath:name_path]; 35 36 UITextField *name = (UITextField *)[name_cell viewWithTag:1]; 37 38 NSLog(@"name was '%@'", name.text); 39 } 40 41 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 42 // Return the number of rows in the section. 43 return 1; 44 } 45 46 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 47 { 48 // Configure the cell... 49 UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; 50 51 return cell; 52 } 53 54 /* 55 // Override to support conditional editing of the table view. 56 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 57 // Return NO if you do not want the specified item to be editable. 58 return YES; 59 } 60 */ 61 62 /* 63 // Override to support editing the table view. 64 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 65 if (editingStyle == UITableViewCellEditingStyleDelete) { 66 // Delete the row from the data source 67 [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 68 } else if (editingStyle == UITableViewCellEditingStyleInsert) { 69 // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 70 } 71 } 72 */ 73 74 /* 75 // Override to support rearranging the table view. 76 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { 77 } 78 */ 79 80 /* 81 // Override to support conditional rearranging of the table view. 82 - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { 83 // Return NO if you do not want the item to be re-orderable. 84 return YES; 85 } 86 */ 87 88 #pragma mark - Navigation 89 90 // In a storyboard-based application, you will often want to do a little preparation before navigation 91 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 92 // Get the new view controller using [segue destinationViewController]. 93 // Pass the selected object to the new view controller. 94 95 // Get the new view controller using [segue destinationViewController]. 96 // Pass the selected object to the new view controller. 97 98 // if (sender != self.saveButton) return; 99 100 // if (self.list_name.text.length > 0) { 101 // self.shared_list = [[SharedList alloc] init]; 102 // self.shared_list.name = self.textField.text; 103 // self.shared_list.list_date = self.datePicker.date; 104 // self.shared_list.members = @"You"; 105 106 NSLog(@"finished editing line '%@'", self.list_name.text); 107 // } 108 109 110 } 111 112 @end