0

I used code from this question Display UIViewController as Popup in iPhone it is working fine but I don't want to use segue or I can say I can't use segue because all the code is created programmatically, so I cant set segue on button.

I used this code but it didn't work

- (IBAction)open:(id)sender {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *newVC = (UIViewController *)[storyboard instantiateViewControllerWithIdentifier:@"Second"];
    [ViewController setPresentationStyleForSelfController:self presentingController:newVC];
    [self.navigationController pushViewController:newVC animated:YES];

}

Edit 1: View after popup

enter image description here

Community
  • 1
  • 1
Varun Naharia
  • 5,318
  • 10
  • 50
  • 84

1 Answers1

0

You should check if this VC self.navigationController is not nil. and i think you want to presentViewController: not pushViewController:...

ozd
  • 1,194
  • 10
  • 34