2012-02-16 6 views
1

ラジオグループのプッシュされたviewcontrollersナビゲーションの項目を正しく設計する方法がわかりません。モノトーンダイアログDatepickerとラジオグループNavigationitem

言語が選択可能なフォローアップ画面では、「戻る」ボタンに「設定」と青色が表示されます。しかし、私はそれを返すようにし、どのメカニズムが存在し、私は既に他のスクリーンで使っているかを設計変更したい。

私はこのようにそれを構築する:

var rootSettings = new RootElement ("Settings"); 
      var sectionNotificationSettings = new Section ("Notification settings"); 

      BooleanElement pushEnabled = new BooleanElement("Push notifications", settings.PushEnabled); 
      sectionNotificationSettings.Add(pushEnabled); 

      var sectionCountrySettings = new Section("Country settings"); 
      var rootRadioGroup = new TransparentRootElement ("Language", new RadioGroup("languages", 0)); 

      var sectionRadioElements = new Section(""); 

      foreach(var language in settings.Languages) 
      { 
       RadioElement selectableLanguage = new RadioElement(language.Key, "languages"); 
       sectionRadioElements.Add(selectableLanguage); 
      } 

      rootRadioGroup.Add(sectionRadioElements); 

      sectionCountrySettings.Add(rootRadioGroup); 

      rootSettings.Add (sectionNotificationSettings); 
      rootSettings.Add(sectionCountrySettings); 

そして、ここで私は私がナビゲーション項目を編集することができます思っTransparentRootElementを定義します。

public class TransparentRootElement : RootElement { 

public TransparentRootElement (string caption) : base (caption) 
{ 

} 

public TransparentRootElement (string caption, Group radioGroup) : base (caption, radioGroup) 
{ 

} 

public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) 
{  
    base.Selected (dvc, tableView, path, true); 
} 

void HandleMenuButtonTouchUpInside (object sender, EventArgs e) 
{ 
    _dvc.NavigationController.PopViewControllerAnimated(true); 
} 

public override UITableViewCell GetCell (UITableView tv) 
{ 
    var cell = base.GetCell (tv); 
    //cell.BackgroundColor = UIColor.White; 

    return cell; 
} 
} 

私は多くの編集アプローチが、のどれを試してみました働いた。また、モノトーンダイアログでElements.csを編集し始めましたが、これも私を大いに助けませんでした。

提案がありますか?

ありがとうございました!

答えて

0

ナビゲーションの戻るボタンを変更すると思いますが、デフォルトの戻るボタンを非表示にしてから独自のボタンを割り当てる必要があります。このことができます

toPushscreen.NavigationItem.SetHidesBackButton(true, true); 
toPushscreen.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, myHandler); 
currentScreen.NavigationController.PushViewController(toPushscreen, true); 

希望:このような何か(あなたが言語画面をプッシュする前に、新しいビューコントローラをプッシュする直前に、私はあなたのケースを信じて、それは次のようになります)!

+0

こんにちはTChadwick、 私は自分自身で言語の画面をプッシュしていません。それはmonotouchdialogを介して行われます。 Radiogroupを持つ新しいRootElementと、グループrootelementをタップすると自動的にプッシュされるセクションを追加するだけです。内部的にはMonTouchDialogはelements.cs内にあるプッシュメカニズムを使用していますが、そこで変更したいとは思いません。 –

+0

説明していただきありがとうございますが、まだモノタッチダイアログを使用した経験はありませんでしたが、最後のモノタッチアップデートに付属しているモノタッチダイアログのバージョンを使用している場合は、 githubの最新バージョンに切り替えるか、githubのバージョンを使用している場合は、最後にモノトックをビルドしたバージョンに切り替えることができます。ちょっとしたアイデア... – TChadwick

関連する問題