[MonoTouch] Problem with custom UIView

bryan costanich b at wowzer.net
Mon Nov 2 19:35:06 EST 2009


Hi all, i'm having a bit of a problem with a custom UIView. this is what i did:


 *   created a new "View Interface Definition" from the template in MonoDevelop
 *   i opened up the xib file in IB, added a label and a button
 *   set the name of the class to be my file name "DropDownButton"
 *   added an outlet for the label on the file owner
 *   put the following code in my code behind:

    public partial class DropDownButton : UIView
    {
        public DropDownButton (IntPtr handle) : base(handle)
        {

        }

        public DropDownButton ()
        {
            NSBundle.MainBundle.LoadNib ("DropDownButton", this, null);
        }

    }


 *   added a UIView to my main window, set the classname to be DropDownButton
 *   ran my app

It runs, but i don't see the UI that i created in the xib file. what am i doing wrong?

also, i tried DropDownButton : NSObject but got the following error at runtime:
Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: *** -[DropDownButton initWithCoder:]: unrecognized selector sent to instance 0x536df70
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20091102/72a80272/attachment.html 


More information about the MonoTouch mailing list