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

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

相关文章:

  • 2021-08-28
  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2021-09-03
  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案