[MonoTouch] How to use MonoTouch.Dialog.UIViewElement?

Felix Collins felix at intranel.com
Sun Mar 18 22:00:17 UTC 2012


I've been trying to figure out how to use MonoTouch.Dialog.UIViewElement because I want to stuff a WebUiView in there. I've done a small test simply putting a UITextView in it but no luck.

UITextView txt = new UITextView();
txt.Text = "Testing txt";

mySection.Add(new UIViewElement("View Element txt", txt, false);


This comes up with a one or two pixel thick row.


I subclassed UIViewElement to try to make it bigger...

public class UIViewElementSizing : UIViewElement, IElementSizing
{
     //ctor omitted - it just passes everything through.

   float IElementSizing.GetHeight(UITableView tableview, NSIndexPath path)
     {
         return 50;
     }
}

... and tried using that.

Now I can see the row but it displays the "View Element txt" string instead of "Testing txt". How do I tell UIViewElement to display the underlying view?
I can't find any examples  that throw light on what I'm doing wrong.  Has anyone got any pointers?

Felix


More information about the MonoTouch mailing list