It is possible to show keyboard without using UITe

2019-03-09 16:40发布

I am working in iPhone messaging based app.

I want to show keyboard with keyboard inputAccessoryView in keyboard without using UITextView and UITextField. It is possible to do this? Please any one help me on this.

Thanks in advance. Looking forward your help. Thanks.

EDIT:

Because i don't want the UITextField/UITextView and the control to be in UITextView/UITextField. I am going to add inputAccessoryView on the keyboard is UITextView. when the user touches the UITextview in the keyboard inputView the actual process will be continue.

5条回答
做自己的国王
2楼-- · 2019-03-09 17:22

I have made a small utility file that can call a Keyboard with a textfield on a button touch !

https://github.com/havocked/TZKeyboardPop

查看更多
爷、活的狠高调
3楼-- · 2019-03-09 17:24

You can try for your answer here:

use-the-system-keyboard-without-a-uitextview

iphone keyboard without textview

And you can try this also.

    UIKeyboard *keyboard = [[[UIKeyboard alloc] initWithFrame: CGRectMake(0.0f,          contentRect.size.height - 216.0f, contentRect.size.width, 216.0f)] autorelease];
    [keyboard setReturnKeyEnabled:NO];
    [keyboard setTapDelegate:editingTextView];
    [inputView addSubview:keyboard];

Here's another option if this could help you.

查看更多
来,给爷笑一个
4楼-- · 2019-03-09 17:25

See the documentation for doing that here:

Simple Text Input

All you need to do is have your view implement UIKeyInput and call [inputView becomeFirstResponder] when the view is touched. Your view also needs to implement canBecomeFirstResponder and return YES.

Sample code from the iOS documentation which does this.

查看更多
看我几分像从前
5楼-- · 2019-03-09 17:25

In xcode simulator:

Sometimes the keyboard wont show because the software keyboard is off. Go to hardware -> Keyboard -> toggle keyboard

查看更多
仙女界的扛把子
6楼-- · 2019-03-09 17:37

For anyone, who wants to show keyboard without UITextField/UITextView for some reasons, could easily extend some view, which requires text input by implementing UIKeyInput protocol and canBecomeFirstResponder method.

查看更多
登录 后发表回答