Henning Schulz
Henning Schulz

Reputation: 627

Monotouch Dialog implementation in a Class derived from UIViewController

I just want to override the Selected method from MonoTouch.Dialog. Simple as that I can not figure out the correct way..

I have a class FirstView which derives from UIViewController. In it I declare

DialogViewController viewController = new DialogViewController();

Also in this class I fill the viewController with a section which contains a UILabel.

Now I want to act on a click on the row containing the label - I don´t want to have a button or something else with an event, I must use the override!

I know this is a fairly easy question but I just can not get it right.

Thank you very much!

Upvotes: 3

Views: 422

Answers (1)

poupou
poupou

Reputation: 43553

If you wish to override a method in MonoTouch.Dialog then you'll need to define your own types. It's the best way to customize MonoTouch.Dialog (when events are not available).

In this case Section inherits from Element where the Selected methods are defined. So doing something like:

public class MySection : Section {
    public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
    {
        // do your own processing
    }
}

should allow you to get your own code called/executed when Selected is being called.

Upvotes: 2

Related Questions