views:

53

answers:

1

My understanding about passing data back to a delegate completely revolves around making a new view controller and having it conform to a protocol.

I am trying to get a time input back from a UIDatePicker set with the UIDatePickerModeCountDownTimer mode and I am running into issues.

Inside of Main1.m I create a UIActionSheet *action, and set everything up so that it presents itself with a UIDatePicker on a click. Inside of Main.m I also say:

main.delegate = self;

If this were not a UIActionSheet, I would make a protocol reference inside the new ViewController and then have the new vc pass data to a method that Main has, but I can't do that with a UIActionSheet!!

What am I missing? I assume there is something inherently different about Action Sheets, ut I can't figure it out.

Thanks for your help!!!

EDIT:

Sorry! I was giving a generic name to my view controller. It isn't actually Main.m, its FirstViewController.h/m

I didn't realize that my generic reference was getting mixed up with the Main.m file that is completely different than a vc.

A: 

I don't exactly understand why you're putting your delegate assignment in Main.m. I assume that you're setting up your UIActionSheet in a ViewController, and launching it from there. In this case, your ViewController is your delegate object. So you need to make sure that your ViewController implements the UIActionSheetDelegate. ie:

@interface SomeController : UIViewController <UIActionSheetDelegate> 

Then you simply implement the required methods of that delegate in your view controller class, and that should do it. If I'm missing something about how you're implementing this, then you need to provide more code examples to examine.

Eric
hey thanks for the tip! I edited my question to clarify the ambiguity. Using the required methods in the UIActionSheetDelegate is just what I needed!
Jerry