8

UIInputView入力アクセサリ ビューを持つテキスト フィールドがあります。

テキスト フィールドをタップすると、キーボードが表示され、アクセサリ ビューのサブビューが表示されますが、背景が表示されません。キーボード アニメーションが完了すると、UIInputView の背景が表示されます。

キーボード アニメーションがまだ進行している間に、UIInputView の背景を強制的に表示するにはどうすればよいですか?

これが私のコードです:

UIInputView *inputView = [[UIInputView alloc] initWithFrame:CGRectMake(0.0f, 0.0f,                 CGRectGetWidth(self.bounds), 44.0f) inputViewStyle:UIInputViewStyleKeyboard];

UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectInset(inputView.bounds, 15.0f, 2.0f);
[button setTitle:@"Button" forState:UIControlStateNormal];
[inputView addSubview:button];

UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.bounds), 44.0f)];
textField.inputAccessoryView = inputView;
[self addSubview:textField];
4

1 に答える 1