How to create a corresponding ViewController class for a Storyboard ViewController in Xamarin

Viewed 143

In a Xamarin iOS project, I have been using add -> new file -> ViewController and that creates a UIViewController class, a Designer file, and an XIB file. Everything is all well there.

I am now however making use of Main.storyboard and I added a new ViewController there (ProjectsViewController). I have already given it that class name inside Identity inspection, even though such a class doesn't exist yet.

I would like to get a view controller class for ProjectsViewController and I know I cannot just create ProjectsViewController.cs that inherits from UIVIewController.

What are the linking steps? I should eventually be able to access my controller outlets inside Xamarin (c# interface).

1 Answers

You can directly create ViewController outlet inside storyboard ,it will automatically create class in your project .

  1. Open Main.storyboard with Xcode .

  2. Create a ViewController inside storyboard.

enter image description here

  1. Name the ViewController .

enter image description here

  1. Save and open visual studio ,you will see that

enter image description here

Related