2012-09-13 65 views
0

我想用MonoTouch.Dialog創建一個非常基本的RadioGroup。當我在選項列表中選擇一個項目並返回到主視圖後,RadioGroup仍顯示選擇了默認值。但是,當我去選擇另一個項目時,我選擇的以前的值仍然被檢查。我在網上查看了幾個例子,他們都沒有做任何特殊的事情來使主視圖反映新選擇的值。我做錯了什麼/失蹤?MonoTouch.Dialog 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); 
      } 
      ); 
     } 
    } 
} 

感謝, 蘭迪

回答

1

它甚至更加明顯比我原來想象。我沒有打電話base.ViewWillAppear