zoukankan      html  css  js  c++  java
  • iOS 实现隐藏系统键盘

    实现隐藏系统键盘,显示自定义键盘吧;

    UITextfield获取焦点时,进入textFieldShouldBeginEditing方法,在这个方法中注册两个通知:

    [[NSNotificationCenter defaultCenter] addObserver:self
                                                     selector:@selector(keyboardWasShown:)
                                                         name:UIKeyboardDidShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                                     selector:@selector(keyboardWillShow:)
                                                         name:UIKeyboardWillShowNotification object:nil];

    //隐藏系统键盘

    - (void)keyboardWillShow:(NSNotification *)Notification{
        UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
        [tempWindow setAlpha:0];
    }

    //显示自定义键盘

    - (void)keyboardWasShown:(NSNotification *) Notification{
    // 添加显示你的自定义键盘 }

  • 相关阅读:
    js冒泡排序的两种实现方式
    LeetCode SQL(一)
    k8s学习之Mac安装最新版本k8s
    docker 安装MySQL8.0设置主从复制
    代码中if的骚操作
    和别人说东西的时候要注意的点
    2021 五一深圳计划
    Swoole支持openssl扩展Mac版
    租房
    Mac常用的快捷键
  • 原文地址:https://www.cnblogs.com/wuwangchuxin/p/3683089.html
Copyright © 2011-2022 走看看