search

Home  >  Q&A  >  body text

keyboard - 请问iOS中如何改变键盘的高度?

iOS中,键盘的高度是不可变的吗?请问有什么办法可以改变它的高度吗?

大家讲道理大家讲道理2772 days ago913

reply all(7)I'll reply

  • PHPz

    PHPz2017-04-17 15:47:22

    You should change your own layout, not someone else's keyboard height.
    The rise to the philosophy of life is:
    Change what you can change, accept what you can't change. :P

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 15:47:22

    It’s basically fixed. Depending on the input method, the keyboard height will be slightly different. You can’t manually change the keyboard height unless you write a keyboard yourself

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:47:22

    Directly press Android

    I am a little tail little tail

    reply
    0
  • PHPz

    PHPz2017-04-17 15:47:22

    The height of third-party keyboards can be adjusted, such as Sogou input method, Baidu input method, etc.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 15:47:22

    You can change it by customizing your keyboard

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 15:47:22

    You can create an attachment view - if you want to add a button, the keyboard height will not change
    //Create an attachment view

    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 40)];
    //打开图片视图的可交互性
    imageView.userInteractionEnabled = YES;
    imageView.image = [UIImage imageNamed:@"inputImage"];
    
    _passField.inputAccessoryView = imageView;

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:47:22

    First of all, the height of other people's keyboards cannot be changed, but it is not immutable. How should I put it? For example, the height of the system's default keyboard will change when you switch between Chinese and English, but this change is not controlled by your code. Instead, you have to adjust your UI according to its changes. For example, in the QQ chat interface, the input box always stays on the keyboard, so you have to layout it after the keyboard height changes.

    The simple way is to receive the following notifications and perform the required corresponding operations

    UIKIT_EXTERN NSString *const UIKeyboardWillShowNotification;
    UIKIT_EXTERN NSString *const UIKeyboardDidShowNotification;
    UIKIT_EXTERN NSString *const UIKeyboardWillHideNotification;
    UIKIT_EXTERN NSString *const UIKeyboardDidHideNotification;

    But this kind of wheel is already available, such as IQKeyboardManager

    Then let’s talk about the custom keyboard (inputView)
    The height can be changed, but the price is that you have to write a keyboard by hand, or refer to QQ’s keyboard for input emoticons, which should be customized.

    Hope it helps you


    Recommended part-time jobs for engineers, click on my avatar for details

    reply
    0
  • Cancelreply