2

Monotouch.Dialog で UITableView.allowsMultipleSelectionDuringEditing を使用したくありません。プロパティが true に設定されている場合、(編集モードが有効になっている) テーブルのクリックは無視されているように見えます (選択は行われません)。Element.Tapped があれば実行されます。私の現在の実装では、新しい UIView を NavigationController にプッシュしますが、これはedit-modeで期待するものではありません。

EditingDialog コンストラクター (DemoEditing.cs:57) を次のように変更するだけで、monotouch.dialog-sample プロジェクトで動作を再現できます。


    public EditingDialog (RootElement root, bool pushing) : base (root, pushing)
    {
      TableView.AllowsMultipleSelectionDuringEditing = true;
    }

EnabledMultipleSelectionDuringEditing を使用する方法はありますか? はいの場合、私のアプローチの何が問題になっていますか?

4

1 に答える 1

0

私は自分のコードで同じ問題を抱えていました。問題は、一部の MonoTouch.Dialog 要素のセル SelectionStyle が UITableViewCellSelectionStyle.None に設定されていることです。

Source または SizingSource をサブクラス化することで解決しました。

public class MyTableViewSource : Source
{
    public MyTableViewSource(DialogViewController container) : base(container)
    {
    }

    public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
    {
        var cell = base.GetCell(tableView, indexPath);
        cell.SelectionStyle = UITableViewCellSelectionStyle.Gray; // something other than None
        return cell;
    }
}

次に、DialogViewController で:

public class MyDialogController : DialogViewController
{
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        // setup root element
        Root = new RootElement();

        // . . .

        TableView.Source = new MyTableViewSource(this);
        TableView.AllowsMultipleSelectionDuringEditing = true;
    }
}
于 2014-02-14T07:47:23.980 に答える