I am trying to create a view class to work with the flyout navigation component. As of yet, I have not found a way to create a view and add subview's to itself. Here is a sample view class that I have created--note, I am not using a XIB file because I would like to avoid XCode--it has been going in and out of sync constantly. This is simply a normal C# file that inherits UIView and attempts to create a view. How do I add subviews to it?
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using FlyoutNavigation;
using MonoTouch.Dialog;
namespace Flyout
{
public class MessagesView : UIView
{
public MessagesView ()
{
var field = new UITextField (new RectangleF(10f, 10f, 300f, 40f));
field.Placeholder = "Test";
field.BorderStyle = UITextBorderStyle.RoundedRect;
// does not work MessagesView.addSubview(field);
var field2 = new UITextField (new RectangleF(10f, 60f, 300f, 40f));
field2.Placeholder = "Test2";
field2.BorderStyle = UITextBorderStyle.RoundedRect;
}
}
}