Home > OS >  How to create class for ViewController in Xamarin.iOS?
How to create class for ViewController in Xamarin.iOS?

Time:10-24

In latest version on Visual Studio for Mac (version 8.10.7), when I am creating native project for Xamarin.iOS and trying to access storyboard it gets opened directly into Xcode.

In old versions Main.Storyboard is got opened in visual studio it self, and from there we are setting name of ViewController class and it creates new ViewController with that name in code. But now as it directly get opened in Xcode. Now how we can create Class for any ViewController or properties for controls taken in storyboard?

Xamarin team has not provided any documents for this updates as well. If anyone know about this?

CodePudding user response:

When you create a project, your Main.storyboard is link with ViewController, you open Main.storyboard in Xcode, click this button First ,then click Second ,you can see Xcode will open the linked ViewController Final

then you can long click Ctrl, and left mouse button long click your Button in storyboard, move mouse to ViewController, when you release mouse, Xcode will show window let you name this Button, then generate code in ViewController, when you close Xcode, Visual Studio will generate code of this Button.

I make a video to youtube how to use xamarin.ios's storyboard

If you want not use the default ViewController to link storyboard, you can create new ViewController at VisualStudio, then change it at here Change Class to MyViewController in Xcode.

  • Related