views:

572

answers:

1

Hi all ,

I want to use custom delegate in my search tab.

I have never used my own custom delegate in any application ( this is the just second one ).

The scenario is as below :

In the search utility ,If I am pressing select category , a modal view controller will be presented in that I am passing a category controller as a parameter .

Now I set its delegate to self .

In the modal view controller , after user selects one of the category and then presses done the done method in the search controller is executed as I have implemented CategoryControllerDelegate .

I have a little idea of all this . But not a full picture .

So tell me how to do all this in code , or If anyone have example ,Please provide the link . EDIT : The question is made a class with custom delegate then set the delegate to self then it should be called on done button tapped in madal view controller .

e.g The Mail Composer

+1  A: 

I'm not entirely sure I understand the question, but if you look at the Utility app template, the way the FlipsideViewController is presented is as a modal view controller.

Basically the modal view controller calls it's delegate with an "i'm done" method, and then the delegate calls [self dismissModalViewControllerAnimated:YES];

if you need to pass data back from the modal view, your "i'm done method" should accept whatever object you need.

Kenny Winker
hey I want to do like the mail composer class . Can you understand how the mail composer class work , have look at it , tell me if you have any idea .
hib
the mail composer class works exactly the same way that the "Utility Application" template does. That's about as stripped-down an example as you're going to get. Have a look at it.
Kenny Winker
thanks you understand it exactaly. saves a lot time ..
hib