How to use custom UIView subclass in XIB editor with Monotouch?

无人久伴 提交于 2019-12-05 07:26:42
Dimitris Tavlikos

Your view subclass needs at least two things:

  1. Register attribute

    [Register("MyView")]

    public class MyView : UIView {}

  2. IntPtr constructor

    public MyView(IntPtr handle) : base(handle) {}

You then open the XIB in Interface Builder, add a UIView and set its Class in the Identity Inspector to the name you passed to the Register attribute. When you connect it to an outlet, you will see that it has the correct type.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!