Passing model objects from one view controller to another in a navigation stack

前端 未结 5 1273
刺人心
刺人心 2021-01-24 04:58

I have two UITableViewControllers. One displays a list of names and on tapping any cell will push the second TableViewController which enables the user to edit the name in a UIT

5条回答
  •  攒了一身酷
    2021-01-24 05:54

    Are they connected by a navigation controller?

    If so, this could solve the problem

    // in SecondViewController.m
    NSArray* controllers = self.navigationController.viewControllers;
    UITableViewController* firstViewController = [controllers objectAtIndex:controllers.count-2];
    

提交回复
热议问题