Mahin
Mahin

Reputation: 61

pushing a DetailViewController from a table in another DetailViewController programatically

I used ShowDetailSegue to push a DetailVewController from another DetailViewController. there is no issues. But my need is to push to a DetailedViewController from a TableView in another DetailedViewController. I used the below code for pushing:-

PushUpExerciseViewController *pushUpObj = [self.storyboard instantiateViewControllerWithIdentifier:@"PushUpID"];
        [self presentViewController:pushUpObj animated:YES completion:nil];

After using this code in my TableView DidSelectRowAtIndexPath the MasterViewController is missing. i need both Master and Detailed ViewControllers. How to push from TableView in DetailViewController to another DetailViewController Programatically

Upvotes: 0

Views: 56

Answers (1)

MD.
MD.

Reputation: 1167

Simply push to View Controller.

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    DetailVewController *objDetailVC = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailVewController"];
    //Pass the data here to DetailViewController
    [self.navigationController pushViewController:objDetailVC animated:YES];
}

As you told you need to push DetailedViewController from another DetailedViewController instance on TableViewCell selection. In this case you need prevent the infinite loop of push.

Flow

Master (Push) -> Detail (Push on didSelectRowAtIndexPath ) -> Detail

Upvotes: 1

Related Questions