EDIT: Since I haven't installed XCode 4 yet, I would like to know if MD 2.8 is fully compatible with XCode 3.2.6 or not. In particular, Am I able to connect Outlets and Actions with the new procedure described in MT documentation?
I've just installed MonoDevelop (MD) 2.8. It seems not working I was expecting.
In MD 2.6 when I create a new UIViewController, that controller is presented like the following:
- Controller.xib <- inside the same tree
- Controller.xib.cs
- Controller.xib.designer.cs
In addition if I open a xib file, Controller.xib, only Interface Builder (IB) is opened. If I add outlets to the xib, the outlets are visible in the Controller.xib.designer.cs.
In MD 2.8 when I create a new UIViewController, that controller is presented like the following:
- Controller.xib <- no more inside the same tree
- Controller.cs
- Controller.designer.cs
So I have two files instead of one.
In addition if I open a xib file, Controller.xib, IB and Xcode are opened. If I add outlets to the xib, the outlets aren't visible in the designer.
Any suggestions?
MonoDevelop 2.8 introduced a new xib designer model in order to support Xcode 4.
The Interface Builder integrated in Xcode 4 no longer supports defining classes, outlets and actions in xib files. This measn it's no longer possible for MonoDevelop to use the model where it generated *.xib.designer.cs files from xib files. Instead, Interface Builder reads outlets and actions from Objective-C source code. MonoDevelop's solution to this is to sync C# classes to Objective-C stubs.
When you open a xib file from MonoDevelop 2.8, MonoDevelop creates a temporary Xcode project with Objective-C stubs mirroring all the C# classes that are exposed to Objective-C, i.e. the classes that inherit from NSObject and are explicitly registered with a
[Register("SomeName")]
attribute. It then opens the xib file in the context of that project, so that Interface Builder will see all the available types and the outlets and action on them. If outlets and actions are added in Xcode 4 using its control-drag system, those are automatically imported back into *.designer.cs files in MonoDevelop.This means that the designer files are no longer generated from some other file, instead they are the actual location where the information is stored. Now the designer files are associated with a class instead of a xib.
This new model has several upsides on top of supporting Xcode 4:
In addition, it's now much easier to write outlets manually. Simply apply the
Outlet
attribute to a property, for exampleUnfortunately the new model means that MonoDevelop no longer integrates with the creation of outlets and actions in Interface Builder 3.2.x. My recommendation is that you upgrade to Xcode 4. Loading and editing of pre-MD 2.8 projects should work fine.
Please see http://docs.xamarin.com/ios/tutorials/transitioning_from_xcode_3_to_xcode_4