を使用しUITableViewController
ていますが、 の下にカスタム ツールバーを追加したいと考えていUIView
ます。
(下のコード) のツールバーを有効にしようとしましたが、navigationController
正しく動作しないようです。UITextField
デリゲートは呼び出されず、テキスト フィールドのキー押下はテキスト フィールド自体には表示されません。
このようなツールバーを使用することは私の最初の選択肢ではありません.UITableViewControllerの下にカスタムビューを配置して、UIToolbarのように機能するアイテムを配置したいと考えています. (UIView フッターのまま)
コード:
self.navigationController.toolbarHidden = NO;
// create toolbar objects
UITextField *inputField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 230, 31)];
inputField.backgroundColor = [UIColor clearColor];
inputField.borderStyle = UITextBorderStyleRoundedRect;
inputField.inputAccessoryView = self.navigationController.toolbar;
inputField.returnKeyType = UIReturnKeyDone;
inputField.delegate = self;
UIButton *sendButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 30)];
sendButton.titleLabel.text = @"Send";
sendButton.backgroundColor = [UIColor greenColor];
// add objects into navigation controller
self.toolbarItems = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc] initWithCustomView:inputField],
[[UIBarButtonItem alloc] initWithCustomView:sendButton], nil];