0

Objective C - iPhone Application

I have 2 programatically instantiated UINavigationControllers

In controller 1 I push this View

-(IBAction) showStartDateCalendar 
{
 ModalSetDateController *setStartDate = [[ModalSetDateController alloc] init];
 [self.navigationController pushViewController: setStartDate animated:YES];
 [setStartDate release];

};

To push it back I was planning on doing something like this:

-(IBAction) PopMyViewControllerBack;

{
 [self.navigationController popViewControllerAnimated: YES];
}

But how would I be able to get the value of the datepicker on ModalSetDateController Is this the best way to handle adding a UIPickerview. I would prefer to not even have a UINavigationController do it. Thanks for your help!

logixologist
  • 3,694
  • 4
  • 28
  • 46

1 Answers1

0

Use:

-(IBAction)popMyViewControllerBack:(id)sender

and sender will be an instance of ModalSetDateController.

drummondj
  • 1,483
  • 1
  • 10
  • 11
  • You can use [self presentModalViewController:setStartDate animated:YES] instead of using a UINavigationController. – drummondj Dec 07 '10 at 08:01
  • Great solution John, so how do I grab the value and get rid of it – logixologist Dec 09 '10 at 06:12
  • value = ((ModalSetDateController*)sender).someProperty; – drummondj Dec 13 '10 at 21:59
  • Getting very close but still have a few issues: I am getting: [ModalSetDateController PopMyViewControllerBack]: unrecognized selector sent to instance 0x729c380 2010-12-17 21:16:39.767 iVT[4447:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ModalSetDateController PopMyViewControllerBack]: unrecognized selector sent to instance 0x729c380' – logixologist Dec 18 '10 at 04:16
  • In my screen that is calling the ViewController that has the datepicker I have -(IBAction) showStartDateCalendar { ModalSetDateController *setStartDate = [[ModalSetDateController alloc] init]; [self presentModalViewController:setStartDate animated:YES]; NSDate *value; value = ((ModalSetDateController*) setStartDate).udp_iVacationDatePicker.date; [setStartDate release]; }; – logixologist Dec 18 '10 at 04:18
  • In my view that has the datepicker: -(IBAction)PopMyViewControllerBack:(id)sender; { [self dismissModalViewControllerAnimated:YES]; } – logixologist Dec 18 '10 at 04:19