私はあなたが上で述べたのとまったく同じブログから始めました。アプリケーション全体で複数のキーボードタイプがあったため、まったく同じ問題が発生しました。
私のソリューションには、次の変更が含まれていました。
1-UIButton*doneButtonをControllerクラスのメンバー変数にします
2-「viewDidLoad」メソッドに、次のスニペットがあります
self.doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
doneButton.frame = CGRectMake(0, 163, 106, 53);
doneButton.adjustsImageWhenHighlighted = NO;
[doneButton setImage:[UIImage imageNamed:@"DoneUp.png"] forState:UIControlStateNormal];
[doneButton setImage:[UIImage imageNamed:@"DoneDown.png"] forState:UIControlStateHighlighted];
[doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];
3-「doneButton」IBActionには、ボタンがキーボードビューから削除されていることを確認するための次のスニペットがあります。
- (IBAction) doneButton:(id)sender {
[self.view endEditing:YES];
[doneButton removeFromSuperview];
}
ボタンを追加するロジックは、ブログで説明されているものと同じです。その指示に従う限り、テンキーにボタンが表示され、[完了]ボタンをクリックするとボタンが削除されます。