LoginSignup
1
1

More than 5 years have passed since last update.

iOSメモ - unwindSegueで閉じて、TableViewに追加する

Last updated at Posted at 2014-09-20

FirstTableVC - navigationVC - editVC



-(IBAction)backToList:(UIStoryboardSegue *)unwindSegue
{
    if([[unwindSegue identifier] isEqualToString:@"EditDone"]){
        TableInputViewController *editVC = unwindSegue.sourceViewController;
        if(self.editingIndexPath){//NSIndexPath editingIndexPath
            //self.navigationController storyboard
        }else{
            //rowの最上部に追加している
            NSIndexPath *indexPathToInsert = [NSIndexPath indexPathForRow:0 inSection:0];
            //editVCとは、遷移先。そこのUITextFieldから取ってきてる
            //itemsとは、FirstTableVCでtableに表示させるNSMutableArray
            [items insertObject:editVC.textFieldInput.text atIndex:indexPathToInsert.row];
            [self.tableView insertRowsAtIndexPaths:@[indexPathToInsert] withRowAnimation:UITableViewRowAnimationFade];
            NSLog(@"追加したよ");
        }
    }
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1