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{
    // 添加显示你的自定义键盘 }

  • 相关阅读:
    数据库使用动态监听导致EM起不来的解决方法
    OCP-1Z0-053-V12.02-115题
    OCP-1Z0-053-V12.02-150题
    OCP-1Z0-053-V12.02-136题
    OCP-1Z0-053-V12.02-154题
    OCP-1Z0-053-V12.02-149题
    OCP-1Z0-053-V12.02-146题
    OCP-1Z0-053-V12.02-160题
    OCP-1Z0-053-V12.02-157题
    OCP-1Z0-053-V12.02-164题
  • 原文地址:https://www.cnblogs.com/wuwangchuxin/p/3683089.html
Copyright © 2011-2022 走看看