Asi Givati
Asi Givati

Reputation: 1475

UIStoryboard instantiateViewControllerWithIdentifier called twice

I have this code, and every time that I'm using it, the viewDidLoad of the destination view is called twice.

why it's happening?

Destination *myDestination = [self.storyboard instantiateViewControllerWithIdentifier:@"destination "];
MyCustomSegue *segue = [[MyCustomSegue alloc] initWithIdentifier:@"CustomSegue" source:self  destination : myDestination];
[segue perform];

Upvotes: 1

Views: 1860

Answers (1)

Burhan Ahmad
Burhan Ahmad

Reputation: 728

I think you can achieve this by calling method presentViewController: animated: completion:; e.g

Destination *myDestination = [self.storyboard instantiateViewControllerWithIdentifier:@"destination "];
[self presentViewController:myDestination animated:YES completion:nil];

I hope this will help you out.

Upvotes: 1

Related Questions