0

我正在尝试学习使用 MonoTouch。我基本上是在尝试创建类似于 iphone 内置的短信应用程序的东西。

我想要根元素中的编辑按钮和添加按钮。这可能吗?

我正在创建像这样的根元素

var root = new RootElement ("My Items");
Section section = new Section();
foreach (var item in GetData()) {
    var element = new RootElement(item.ItemName,0,0) {
        new Section(item.Description)
    };
    section.Add(element);
}
root.Add(section);

我需要做什么来添加 2 个按钮并加载不同的视图?

4

1 回答 1

2

您可能正在将根添加到对话框视图控制器,

var dv = new DialogViewController(root,true);

在这种情况下,只需初始化视图控制器导航项的按钮

dv.NavigationItem.RightBarButtonItem = new UIBarButtonItem("Edit", UIBarButtonItemStyle.Plain,null);

等等并为 dv.NavigationItem.RightBarButtonItem.Clicked 设置事件处理程序。

应该这样做!

于 2011-07-05T18:15:58.867 回答