Luis
Luis

Reputation: 6001

Monodevelop 2.8 Xcode 4 Custom class on xib UI Components

How do you set a custom class on a UI component in Interface Builder, so say I have a class in my project that extends UITableView how do I associate a component in Interface Builder to use that custom class? I type the class name into the custom class placeholder but it replaces that with UITableView...

Any Ideas?

Thanks

Upvotes: 1

Views: 597

Answers (2)

Mikayla Hutchinson
Mikayla Hutchinson

Reputation: 16153

In order to make the class usable from Interface Builder (and Objective-C), you need to register it using an explicit name, for example

[Register ("MyTableView")]
public class MyTableView : UITableView
{
    //...
}

Then MonoDevelop will be able to synchronize the class out to Xcode and it will be visible in Interface Builder.

Classes in project and xib/storyboard templates are already registered in this way, though the attribute may be in the partial designer class.

Upvotes: 0

miguel.de.icaza
miguel.de.icaza

Reputation: 32694

Make sure you have this mode active (the right hand side pane), your view selected and the third pane selected like this:

http://tirania.org/s/f6111a1a.png

Then just set the name of the class there. When you save the file and switch back to MonoDevelop, it will automatically stub the class for you if you are using Storyboards.

Upvotes: 3

Related Questions