Search code examples
c#xcode4xamarin.iosmonodevelopoutlet

How to create an Outlet with MonoTouch + Xcode 4 == No Assistant Rules


I'm trying to create my first outlet with MonoTouch and Xcode 4.

When I click on the Assistant Editor it displays No Assistant Rules. It should be showing the .h file code.

What I did was create a new IPad Tabbed Application, and then renamed FirstViewController.cs to SettingsController.cs, and the .designer.cs file didn't get renamed. So I tried closing down MonoTouch and Xcode 4 then manually renaming the file in Finder, then opening up the .proj file in some TextEdit, replacing all instances of FirstViewConoller with SettingsController, reopening up the solution etc, and then seeing if Xcode 4 now knows about the .h file.

For what it's worth, when I click on the Assistant Editor for the SecondViewController, I do get some .h file code displayed in there, and I can drag-drop an outlet onto that.


Solution

  • If you rename the class instead of renaming the file, then both the source file and the designer file will be renamed to be patterned on the new name of the class.

    That said, the reason you probably aren't getting header files for your SettingsController class is because of a race condition in MonoDevelop (fixed in the upcoming 2.8.8.2). What is happening is that MonoDevelop is still indexing (or hasn't started) your project, getting a list of known classes and their properties/methods/etc. Since that information is incomplete when you double-click a .xib to launch Xcode, the xcode-sync logic doesn't know about those classes and so doesn't sync out any mirrored ObjC classes for them.