This should be enough to refresh your memory.
MyDatePickerViewController.h:
@protocol MyDatePickerViewControllerDelegate;
@interface MyDatePickerViewController;
MyDatePickerViewController : UIViewController
{
id<MyDatePickerViewControllerDelegate> delegate;
NSDate* selectedDate;
}
@property (nonatomic, assign) id<MyDatePickerViewControllerDelegate> delegate;
@property (nonatomic, retain) NSDate* selectedDate;
@end
@protocol MyDatePickerViewControllerDelegate
- (void)myDatePickerViewControllerDidFinish:(MyDatePickerViewController*)myDatePickerViewController;
@end
MyDatePickerViewController.m:
@implementation MyDatePickerViewController
@synthesize delegate;
@synthesize selectedDate;
- (void)dealloc
{
[selectedDate release];
[super dealloc];
}
- (void)someMethodCalledWhenUserIsDonePickingDate
{
[delegate myDatePickerViewControllerDidFinish:self];
}
MyRootViewController.h:
#import MyDatePickerViewController
@interface MyRootViewController : UIViewController <MyDatePickerViewControllerDelegate>
{
...
}
@end
MyRootViewController.m:
@implementation MyRootViewController
- (void)myDatePickerViewControllerDidFinish:(MyDatePickerViewController*)myDatePickerViewController
{
NSDate* date = myDatePickerViewController.selectedDate
// Do something with the date that was chosen
}
@end