Reputation: 257
new to Xamarin / MonoTouch
I have a Universal storyboard App (ipad and iphone) I use storyboards
So I have linked a segue from the MainViewController to a secondaryViewController (educateViewController).
I do not use nor do I want to use a navigation controller (I'm able to do this in native iOS)
I'm struggling with PerformSegue call which results in
System.Exception: Selector invoked from objective-c on a managed object of type MyTestApp.educateViewController (0x9827E50) that has been GC'ed ---> System.Exception: No constructor found for MyTestApp.educateViewController::.ctor(System.IntPtr)
I have private educateViewController educateScreen;
and inside ViewDidLoad() educateScreen = new educateViewController();
partial void educate (MonoTouch.Foundation.NSObject sender)
{
solveIt(sender);
if (valid) {
if (UserInterfaceIdiomIsPhone) {
this.PerformSegue("educate", this); <<<< error occurs here
} else if (UserInterfaceIdiomIsiPad) {
this.Instructor.Hidden = false;
}
}
}
Segue should only be called if it is on the iPhone
All help welcome, thanks in advance
Upvotes: 0
Views: 1279
Reputation: 14294
To Perform Segue:
this.PerformSegue("segueIdentifier here", this);
On Target class, Add:
protected MyCustomController(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
Note: Please change 'MyCustomController' as your target controller name.
Upvotes: 0
Reputation: 3358
You need to make sure the EducateViewController implements the following constructor:
public EducateViewController (IntPtr handle) : base (handle)
{
}
That should allow the view controller to be instantiated from the Storyboard.
Upvotes: 3