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

iOS 实现隐藏系统键盘,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。