3

このコード (テキストボックスにフォーカスしたときに表示される日付ピッカー) は ios6 では完璧ですが、ios7 では [完了] ボタンをクリックできません:

- (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];


}

ありがとう

4

0 に答える 0