Using the MonoTouch.Dialog feature to create an application similar to the SMS application
I am trying to learn using MonoTouch. I am basically trying to create something similar to the sms message application that is built into开发者_如何学JAVA the iphone.
I want the Edit button and a add button within the root element. Is this possible?
Im creating the root element like
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);
What do I need to do to add the 2 buttons and load the different views?
You are probably adding the root to a dialog view controller,
var dv = new DialogViewController(root,true);
In this case, just initialize the buttons for the navigation items of the view controller
dv.NavigationItem.RightBarButtonItem = new UIBarButtonItem("Edit", UIBarButtonItemStyle.Plain,null);
and so on and set up event handlers for dv.NavigationItem.RightBarButtonItem.Clicked.
That should do it!
精彩评论