简体   繁体   中英

Add MonoTouch.Dialog on PopOverView

I'm trying to add an dialog to an CustomPopoverViewController ( see picture ) but I can't add it to the view. I have tried different methods but it will not display.

[Register("MyCustomPopoverViewController")]
public partial class MyCustomPopoverViewController : UIViewController
{
    DetailViewController appd;

    public MyCustomPopoverViewController (DetailViewController app)
    {
        appd = app;
    }

    public override void ViewDidLoad ()
    {
        Console.WriteLine ("Paged view did load");
        this.ContentSizeForViewInPopover = new SizeF (370, 670);

        var root = new RootElement ("Meals"){
        new Section ("Dinner"){
                new RootElement ("Desert", new RadioGroup ("desert", 2)){
                    new Section (){
                    new RadioElement ("Ice Cream", "desert"),
                    new RadioElement ("Ice Cream", "desert"),
                    new RadioElement ("Ice Cream", "desert"),
                    new RadioElement ("Ice Cream", "desert"),
                    new RadioElement ("Ice Cream", "desert")
                    }
                }
            }       
        };
    }   
}

I have found the answer my self. The solution is like this:

        public override void ViewDidLoad ()
    {
        Console.WriteLine ("Paged view did load");
        this.ContentSizeForViewInPopover = new SizeF (370, 670);

        var root = new RootElement ("Meals"){
        new Section ("Dinner"){
                new RootElement ("Desert", new RadioGroup ("desert", 2)){
                    new Section (){
                    new RadioElement ("Ice Cream", "desert"),
                    new RadioElement ("Ice Cream", "desert"),
                    new RadioElement ("Ice Cream", "desert"),
                    new RadioElement ("Ice Cream", "desert"),
                    new RadioElement ("Ice Cream", "desert")
                    }
                }
            }       
        };
                    // This is the solution!
        var dv = new DialogViewController (root);
        View.Add(dv.View);
    }   

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM