我添加了一个UITableViewController
静态单元格。我有一个条形按钮“保存”,但是当我单击该按钮时,prepareForSegue
根本不会调用该方法。这是我的代码:
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"AddCustomer"]) {
UINavigationController *navigationController = segue.destinationViewController;
AddCustomersViewController *addCustomersViewController = [[navigationController viewControllers] objectAtIndex:0];
addCustomersViewController.delegate = self;
}
}
这是我的代表方法
-(void) customerDidSave:(AddCustomersViewController *)controller newCostomer:(Customers *)customer
{
[self dismissViewControllerAnimated:YES completion:nil];
[self.customers addObject:customer];
[self.tableView reloadData];
}
我不知道是什么问题。有任何想法吗?