views:

48

answers:

1

Hi,

I'm struggling with the basics on how to build views in Monotouch and how to tie them to C# code.

I know how to create an outlet for an UIViews that are on the Main window. But how can I create an oulet for an UIView that is located on a different view?

The main view has an AppDelegate class I can bind the outlets to. But there's nothing comparable on additional views, even though I chose to create an "Iphone view with Controller".

+2  A: 

When you create an "iPhone view with controller", you can open the view controller xib and place your outlets in the UIViewController. So, if you call the new view controller MyViewContoller, you create the outlets on the MyViewController class in interface builder.

MyViewController will be the "File's Owner" in the Interface Builder project window.

Then, you can set up button handlers, etc by overriding MyViewController's ViewDidLoad method.

dommer
Thanks, that was exactly what threw me off - File's Owner isn't exactly descriptive, plus my controller's actual type also appears in the Interface Builder, but adding the outlet there won't do anything useful.
Adrian Grigore