3

This code (datepicker that appear when people focus a textbox)is perfect on ios6 but on ios7 the "Done button" can't be clicked:

- (void)textFieldDidBeginEditing:(UITextField *)textField
{

    UIToolbar *pickerDateToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 40)];


    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(closeText)];
    [barItems addObject:doneBtn];

    [pickerDateToolbar setItems:barItems animated:YES];
     [textField.inputView addSubview:pickerDateToolbar];


}

Thanks

rmaddy
  • 314,917
  • 42
  • 532
  • 579
lrnzfrr
  • 170
  • 13

0 Answers0