Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何将MonoTouch.Dialog元素嵌入ViewController?_Ios_Xamarin.ios_Monotouch.dialog_Radioelement - Fatal编程技术网

Ios 如何将MonoTouch.Dialog元素嵌入ViewController?

Ios 如何将MonoTouch.Dialog元素嵌入ViewController?,ios,xamarin.ios,monotouch.dialog,radioelement,Ios,Xamarin.ios,Monotouch.dialog,Radioelement,我正在尝试使用这个: 我可以看到视图元素,当我这样做。。。但是,单击其中一个单选元素不会执行任何操作(例如,显示复选框)。不知道我做错了什么 下面是我在ViewDidLoad()中使用的代码 我发现对话框控制器扩展到viewcontroller的边缘时出现问题 解决方案是添加一个中间UIView作为容器,以强制DialogController保持在正确的边界内 正确的代码是: var rootElement = new RootElement("Question Text", new Radi

我正在尝试使用这个:

我可以看到视图元素,当我这样做。。。但是,单击其中一个单选元素不会执行任何操作(例如,显示复选框)。不知道我做错了什么

下面是我在ViewDidLoad()中使用的代码


我发现对话框控制器扩展到viewcontroller的边缘时出现问题

解决方案是添加一个中间UIView作为容器,以强制DialogController保持在正确的边界内

正确的代码是:

var rootElement = new RootElement("Question Text", new RadioGroup("answer", 0))
{
   new Section()
   {
        new RadioElement("Answer A", "answer"),
        new RadioElement("Answer B", "answer"),
        new RadioElement("Answer C", "answer"),
        new RadioElement("Answer D", "answer")
    }
 };

 _questionDialogViewController = new DialogViewController(rootElement);
 _questionDialogViewController.View.BackgroundColor = UIColor.Clear.FromHexString(AppDelegate.EventModel.MainBackgroundColor);
 _questionDialogViewController.View.Frame = new RectangleF(0, 0, 964, 500);

 var answerContainer = new UIView(new RectangleF(30, 150, 964, 500));
 answerContainer.AddSubview(_questionDialogViewController.View);

 View.AddSubview(answerContainer);
var rootElement = new RootElement("Question Text", new RadioGroup("answer", 0))
{
   new Section()
   {
        new RadioElement("Answer A", "answer"),
        new RadioElement("Answer B", "answer"),
        new RadioElement("Answer C", "answer"),
        new RadioElement("Answer D", "answer")
    }
 };

 _questionDialogViewController = new DialogViewController(rootElement);
 _questionDialogViewController.View.BackgroundColor = UIColor.Clear.FromHexString(AppDelegate.EventModel.MainBackgroundColor);
 _questionDialogViewController.View.Frame = new RectangleF(0, 0, 964, 500);

 var answerContainer = new UIView(new RectangleF(30, 150, 964, 500));
 answerContainer.AddSubview(_questionDialogViewController.View);

 View.AddSubview(answerContainer);