0

I found this link how to create tool bar above keyboard. But I don't use any textfield that I need to tap and show keyboard. My idea is press on "Leave comment" button and then keyboard with a text field will be appeared.

So in the link I've attached they seems use inputAccessoryView of text field you interact with. But in my case I don't have any text field.

So first of all I need to toggle keyboard without text field and then show keyboard with a textfield like a bar above keyboard. How can I make it?

Community
  • 1
  • 1
Matrosov Alexander
  • 20,713
  • 42
  • 130
  • 259
  • http://stackoverflow.com/questions/18957476/ios-7-keyboard-animation/19236013 The link was very helpful for me when I did the same job. – Wonjung Kim Jun 25 '15 at 12:35

1 Answers1

4

Hello you need to put your UITextfield outside the View, like this:

enter image description here

ViewController.h

@property (strong, nonatomic) IBOutlet UITextField *_myTextField;

ViewController.m

UITextField *t = [UITextField new];
[self.view addSubview:t];
[t becomeFirstResponder];
t.inputAccessoryView = _myTextField;

see the result: enter image description here

benhi
  • 576
  • 1
  • 5
  • 22