Question

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

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top