-2

I want to be able to show a viewController when a button is pressed.

I don't want to use a navigation controller anymore, is there a way to display it using a modal?

Here is how I am currently showing the viewController:

- (void) editButtonDidClicked: (UIButton *) button {
    EditViewController *viewController = [EditViewController getInstanceWithTag:button.tag];
    [self.navigationController pushViewController:viewController animated:YES];
}
rmaddy
  • 307,833
  • 40
  • 508
  • 550

1 Answers1

1

You can try below code

I assume that you are using storyboard.

UIStoryboard *board = [UIStoryboard storyboardWithName:@"name" bundle:nil];
viewController *controller = [board instantiateViewControllerWithIdentifier:@"Identifier"]; // Identifier is define in storyboard
[self presentViewController:controller animated:YES completion:nil];

Please check out this link if you are still facing the problem.

Hope this helps you.

Community
  • 1
  • 1
Malav Soni
  • 2,549
  • 1
  • 19
  • 42