Interface Builder XIB files can contain objects that are instances of user classes, normally subclasses of UI controller classes. These have outlets (analogous to properties) and actions (analogous to events) that can be connected to interface objects. At runtime, when the IB file is loaded, the objects are created, and the outlets and actions are connected to the various UI objects dynamically. When defining these managed classes, you must define all the actions and outlets to match the ones that IB expects. MonoDevelop uses a CodeBehind-like model to simplify this. This is similar to what Xcode does for Objective-C, but the code generation model and conventions have been tweaked to be more familiar to .NET developers.
For any {0}.xib file with a build action of Page, if a {0}.xib.designer.cs file also exists in the project, MonoDevelop will generate partial classes in the designer file for all of the user classes it can find in the XIB file, with properties for the outlets and partial methods for all of the actions. Code generation is enabled simply by the presence of this file.
If you prefer not to use MonoDevelop, there is also a command-line utility included in the MonoTouch SDK (/Developer/MonoTouch/usr/bin/mibtool) that can be used to generate designer files.
MonoDevelop generates the designer classes using the project's default namespace for the designer file location, to make it consistent with normal .NET project namespacing. Beware that if your project's default namespace changes, MD will regenerate the classes in the new namespace, so you may find that your partial classes no longer match up.
In order to make the class discoverable by the Objective-C runtime, MD applies a [Register (name)] attribute to the class. Although the MonoTouch automatically registers NSObject-derived classes, it uses the fully-qualified .NET name. The attribute applied by MD overrides this to ensure it's registered it with the name used in the IB file. If you use custom classes in IB without using MonoDevelop to generate designer files, you may have to apply this manually to make your managed classes match up to the expected Objective-C class names.
Note that MonoDevelop does not set the base class of the generated classes, in order to allow you flexibility. For every generated partial class, you are expected to add a part that defines the base class, the action bodies, and any other code you want. It is conventional to put these in a {0}.xib.cs file beside the {0}.xib.designer.cs designer file.
In the partial designer classes, MonoDevelop generates properties corresponding to any connected outlets defined in IB, and partial methods corresponding to any connected actions. Note that MD only generates code for connected outlets/actions, so that it can determine a specific type of the property or the action's sender.
Although the outlets are properties, they are private. You can think of them effectively as fields; the only reason they are properties is to enable lazy binding. If you wish to break encapsulation, you can expose them through public wrapper properties.
Actions are generated as partial methods for C#. Unfortunately CodeDOM doesn't support partial methods, so they are not yet generated for other languages. MD's partial method completion, triggered by the partial keyword, assists in implementing the methods. You are free to ignore the partial method and implement the action manually.
Sometimes users wish to reference the same class from multiple XIB files, for example with tab controllers. This can be done by explictly referencing the class definition from another XIB file, or by defining the same class name again in the second XIB.
The latter case can be problematic. Because MD processes XIB files individually, it cannot automatically detect and merge duplicate definitions, so you may end up with conflicts applying the Register attribute multiple times when the same partial class is defined in multiple designer files. Recent versions of MonoDevelop attempt to resolve this, but this may not always work as expected. If you encounter problems, please file bug reports against MonoDevelop.