开发者

Monodevelop 2.8 Xcode 4 Custom class on xib UI Components

开发者 https://www.devze.com 2023-04-11 07:58 出处:网络
How do you set a custom class on a UI componen开发者_开发技巧t 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

How do you set a custom class on a UI componen开发者_开发技巧t 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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号