I have 2 storyboards: Activities.storyboard
and Contacts.storyboard
.
On Contacts.storyboard
I have a ViewController: ContactDetails
.
On Activities.storyboard
I need refer the ContactDetails
in Contacts.storyboard
I created a Storyboard Reference
on Activities.storyboard
and referenced the ContactDetails
.
And I tried load this View Controller programmatically
var viewController = Storyboard.InstantiateViewController(nameof(ContactDetails));
NavigationController.PushViewController(viewController, true);
But I didn't work to load programmatically as a normal View Controller
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: Storyboard () doesn't contain a view controller with identifier 'ContactDetails'
I know it works this way:
var storyboard = UIStoryboard.FromName(nameof(Contact), null);
var viewController = storyboard.InstantiateViewController(nameof(ContactDetails));
NavigationController.PushViewController(viewController, true);
But I want to use a Reference View Controller, is it possible?
Apparently the only way to load Storyboard Reference is with Segue.
Programmatically the only way is instantiate the Storyboard
and after instantiate the ViewController
Like this:
var storyboard = UIStoryboard.FromName(nameof(Contact), null);
var viewController = storyboard.InstantiateViewController(nameof(ContactDetails));
NavigationController.PushViewController(viewController, true);