Xcode 6 - Push segue to same view controller

前端 未结 3 1512
抹茶落季
抹茶落季 2021-01-18 02:04

I have a table view controller and tapping on a cell can trigger one of many different types of push segues based on the type of data in the cell. The identifier of the corr

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 02:33

    As suggested, I don't think a segue will work. Instead you can push a new instance of the same view controller programmatically, which will have the same effect as performing the segue. The difference is that segue delegate methods like prepareForSegue won't be called.

    - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        MyViewController *vc = [[MyViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    } 
    

提交回复
热议问题