Xamarin.ios 与带有MonoTouch对话框的modal RadioGroup节一起使用时,无法更新根元素的文本

Xamarin.ios 与带有MonoTouch对话框的modal RadioGroup节一起使用时,无法更新根元素的文本,xamarin.ios,monotouch.dialog,Xamarin.ios,Monotouch.dialog,我正在使用MonoTouch 2.10.11创建一个iPad应用程序,我想要MonoTouch.Dialog在表单上创建一些可编辑字段。其中一个字段将使用RadioGroup允许用户从选项列表中进行选择。M.T.D的默认行为是在现有表上显示选择列表表。这对于iPhone布局非常有效,但是在这个iPad表单上,表格只在表单的一小部分,导航栏在表单中间看起来很奇怪。我想将选择显示为全屏模式,用户将点击“后退”按钮,返回上一个表单和所选项目 我创建了一个新的RootElement子类,如下所示: pu

我正在使用
MonoTouch 2.10.11
创建一个
iPad
应用程序,我想要
MonoTouch.Dialog
在表单上创建一些可编辑字段。其中一个字段将使用
RadioGroup
允许用户从选项列表中进行选择。
M.T.D
的默认行为是在现有表上显示选择列表表。这对于
iPhone
布局非常有效,但是在这个
iPad
表单上,表格只在表单的一小部分,导航栏在表单中间看起来很奇怪。我想将选择显示为全屏模式,用户将点击“后退”按钮,返回上一个表单和所选项目

我创建了一个新的
RootElement
子类,如下所示:

public class ModalRootElement : RootElement 
{    
    public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
    {
        tableView.DeselectRow (path, false);
        UIViewController uIViewController = this.MakeViewController ();
        this.PrepareDialogViewController (uIViewController);
        dvc.PresentViewController (uIViewController, true, null);
    }

    protected override void PrepareDialogViewController(UIViewController dvc)
    {
        base.PrepareDialogViewController(dvc);

        UIButton button = UIButton.FromType (UIButtonType.RoundedRect);
        button.Frame = new RectangleF (5, 5, 80, 20);
        button.SetTitle ("back", UIControlState.Normal);
        button.TouchUpInside += delegate {
            DialogViewController d = dvc as DialogViewController;

            (d.Root as ModalRootElement).TableView.ReloadData ();

            d.DeactivateController(true);
        };
        dvc.View.AddSubview (button);
    }
}
该表使用以下代码实现:

var _status = new ModalRootElement("Status", new RadioGroup("status", -1)) {
    (new Section() {
        new RadioElement("New", "status"),
        new RadioElement("In process", "status"),
        new RadioElement("Rejected", "status"),
        new RadioElement("Deferred", "status"),
        new RadioElement("Transferred", "status"),
        new RadioElement("Unknown", "status"),
        new RadioElement("Complete", "status")
    })
};

var _odom = new EntryElement ("Odometer", "current odom", "");
_odom.KeyboardType = UIKeyboardType.DecimalPad;
_odom.TextAlignment = UITextAlignment.Right;

var root = new RootElement ("back") {
    new Section("") {
        _status,
        _odom
    }
};

_dvc = new DialogViewController(root);
_nav = new UINavigationController (_dvc);
_nav.SetNavigationBarHidden (true, false);
当我运行应用程序时,我可以钻入
RadioGroup
并进行选择。当我单击添加到视图中的后退按钮时,模式视图将关闭,
ModalRootElement
对象的
RadioSelected
属性设置正确,但文本不会显示


如果我将
Selected()
方法更改为调用
dvc.ActivateController
而不是
PresentViewController
,则
ModalRootElement
显示正确的文本,但
RadioGroup
表的大小不正确。当您使用
PresentViewController
而不是
ActivateController
时,有没有办法让
RootElement
显示正确的文本?

我想您需要一个Root.Reload()调用。

这不是一个真正的答案,所以我将其作为注释。您是否尝试过按视图控制器?然后,您可以稍后
PopViewController
。此外,您还可以从RadioElement类继承创建自己的
RadioElement
。这将允许您拥有一个事件,您可以连接到该事件,并在上一个屏幕上设置radiogroup中文本的索引。我希望这是有道理的。