Как насчет создания нового UIView и добавления в него кнопки выбора даты и завершения?

какиваю DatePicker со следующим. Теперь я пытаюсь добавить кнопку Готово в верхней части всплывающего окна.

-(IBAction) contactBDayDatePicker{

NSLog(@"contactBDayDatePicker");

pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeDate;

if (self.pickerView.superview == nil){

    [self.view.window addSubview: self.pickerView];

    // size up the picker view to our screen and compute the start/end frame origin for our slide up animation
    //
    // compute the start frame
    CGRect screenRect = [[UIScreen mainScreen] applicationFrame];

    NSLog(@"screenRect %@",NSStringFromCGRect(screenRect));

    CGSize pickerSize = [self.pickerView sizeThatFits:CGSizeZero];

    NSLog(@"pickerSize %@",NSStringFromCGSize(pickerSize));

    CGRect startRect = CGRectMake(0.0,
                                  screenRect.origin.y + screenRect.size.height,
                                  pickerSize.width, pickerSize.height);
    self.pickerView.frame = startRect;

    NSLog(@"pickerView.frame %@",NSStringFromCGRect(startRect));

    // compute the end frame
    CGRect pickerRect = CGRectMake(0.0,
                                   screenRect.origin.y + screenRect.size.height - pickerSize.height,
                                   pickerSize.width,
                                   pickerSize.height+10);

    NSLog(@"pickerRect %@",NSStringFromCGRect(pickerRect));

    // start the slide up animation
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];

    // we need to perform some post operations after the animation is complete
    [UIView setAnimationDelegate:self];

    self.pickerView.frame = pickerRect;

    [UIView commitAnimations];

}

 } 

Я попытался увеличить размер кадра на 10 пунктов (см. CGSize pickerSize выше) и подумал, что мог бы использовать что-то вроде следующего, но кнопка отказывается отображать, плюс я не уверен, как разместить кнопку внутри самого кадра pickerSize. (BTW) DatePicker и Button накладываются на scrollView, если это имеет значение.

  UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  [button setTitle:@"Done" forState:UIControlStateNormal];
  button.center = CGPointMake(160,240);
  [button addTarget:self action:@selector(done)    forControlEvents:(UIControlEventTouchUpInside)];
  [self.view addSubview:button];

Любые мысли приветствуются.

Ответы на вопрос(5)

Ваш ответ на вопрос