【问题标题】:MonoTouch.Dialog RadioGroup summary not updatingMonoTouch.Dialog RadioGroup 摘要未更新
【发布时间】:2012-09-13 03:47:51
【问题描述】:

我正在尝试使用 MonoTouch.Dialog 创建一个非常基本的 RadioGroup。在我选择选项列表中的一项并返回主视图后,RadioGroup 仍显示已选择默认值。但是,当我去选择另一个项目时,我之前选择的值仍然被选中。我在网上查看了几个示例,它们似乎都没有做任何特别的事情来使主视图反映新选择的值。我做错了什么/错过了什么?

这是我的代码的简化版本:

using System;
using MonoTouch.Dialog;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace TestApp
{
    public class MainSettings : DialogViewController
    {
        public MainSettings (UIViewController parent) : base (UITableViewStyle.Grouped, null)
        {
            Root = new RootElement ("Settings")
            {
                new Section("Cellular Network") 
                {
                    new RootElement("Refresh Data", new RadioGroup(2))
                    {
                        new Section()
                        {
                            new RadioElement("Every 5 Minutes"),
                            new RadioElement("Every 15 Minutes"),
                            new RadioElement("Every 30 Minutes"),
                            new RadioElement("Hourly"),
                            new RadioElement("Manually")
                        }
                    }
                }
            };
        }

        public override void ViewWillAppear (bool animated)
        {
            NavigationItem.RightBarButtonItem = new UIBarButtonItem ("Close", UIBarButtonItemStyle.Plain, delegate
            {
                DismissModalViewControllerAnimated (true);
            }
            );
        }
    }
}

谢谢, 兰迪

【问题讨论】:

    标签: xamarin.ios monotouch.dialog


    【解决方案1】:

    这比我最初想象的还要明显。我没有调用 base.ViewWillAppear

    【讨论】:

      猜你喜欢
      • 2012-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多