I'm porting a native objective-C app to a Monotouch solution.
I have a in my storyboard a tableview, with some static table cells.
Using following objective-c code a received a selection from the table
- (void) tableView:(UITableView *) aTableView didSelectRowAtIndexPath:(NSIndexPath *) indexPath
{ // remove the row highlight
[aTableView deselectRowAtIndexPath:indexPath animated:YES];
switch(indexPath.row) {
case 0: [self callWebsite]; break;
case 1: [self sendEmail]; break;
case 2: [self makePhoneCall]; break;
}
return;
}
Now I want to do the same in MonoTouch, but can't find out how and all the examples I find on the net, are using the DataSource and UITableViewDelegate.
But when using that approach, My "Static" cells are removed, replaced.
This is what I'm trying
public partial class ContactViewController : UITableViewController
{
public ContactViewController (IntPtr handle) : base (handle)
{
this.TableView.Delegate = new CustomTableViewDelegate();
}
}
public class CustomTableViewDelegate : UITableViewDelegate
{
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
// Remove the row highlight
RowDeselected(tableView, indexPath);
/*
// Is this section our "button" section?
switch(indexPath.row) {
case 0: [self callWebsite]; break;
case 1: [self sendEmail]; break;
case 2: [self makePhoneCall]; break;
}
*/
Console.WriteLine("Do something meaningfull.");
}
}
Somebody any suggestion?