title: Help With UIDatePicker In UIActionSheet
body: <p>I used some modified code found from another question on this website.</p>
  
  <p>I am not sure however exactly what <code>theDatePicker</code> and <code>dtpicker</code> are.  I need to declare them but I don't know exactly if they are supposed to be a UIDatePicker and why there are two of them.  Can anyone figure it out? Thanks.</p>
  
  <pre><code>- (IBAction)dateButtonPressed1
  {
      UIActionSheet *aac = [[UIActionSheet alloc] initWithTitle:@"Select Date"
                                                       delegate:self
                                              cancelButtonTitle:nil
                                         destructiveButtonTitle:nil
                                              otherButtonTitles:nil];
      self.dtpicker = theDatePicker;
      [theDatePicker release];
      [dtpicker addTarget:self action:@selector(dateChanged) forControlEvents:UIControlEventValueChanged];
  
      pickerDateToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
      pickerDateToolbar.barStyle = UIBarStyleBlackOpaque;
      [pickerDateToolbar sizeToFit];
  
      NSMutableArray *barItems = [[NSMutableArray alloc] init];
  
      UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
      [barItems addObject:flexSpace];
  
      UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(DatePickerDoneClick)];
      [barItems addObject:doneBtn];
  
      [pickerDateToolbar setItems:barItems animated:YES];
  
      [aac addSubview:pickerDateToolbar];
      [aac addSubview:dtpicker];
      [aac showInView:self.view];
      [aac setBounds:CGRectMake(0,0,320, 464)];
  }
  </code></pre>
  
  <p>Link to original question where I found code: <a href="https://stackoverflow.com/questions/1262574/add-uipickerview-a-button-in-action-sheet-how">Add UIPickerView &amp; a Button in Action sheet - How?</a></p>