Forum Xamarin Xamarin.iOS

Custom Control Class

MMountainMMountain USMember ✭✭

Ok ,so I can't figure this out and it's driving me nuts. I have a class, and specifying it's base class as UILabel. I have a xib, and I place a UILabel on the view, then set it's custom class to my custom class and create an outlet. When I run the app I get "Object reference not set to an instance of an object".

Below is my class. Am I missing a method or something?

[Register ("NACustomControlOne")]
    public class CustomControlOne : UILabel
    {
        public CustomControlOne()
        {
        }

        public CustomControlOne(IntPtr p) : base(p)
        {
        }

        public CustomControlOne(RectangleF frame) : base(frame)
        {
        }

        public override void AwakeFromNib()
        {
            base.AwakeFromNib();
        }
    }

Posts

  • MMountainMMountain USMember ✭✭

    Never mind, developer error :(

    For anyone else looking to do the same thing, those are the only methods you need. In my case I was using a test viewController that I didn't implement correctly into my menu system.

Sign In or Register to comment.